[gtkada] File selector

manuel.op.de.coul at eon-benelux.com manuel.op.de.coul at eon-benelux.com
Wed Mar 6 22:42:20 CET 2002


While working on a new file selection dialog for my application,
I found out what is wrong with the Gtk file selector, making it
so slow under Windows. At least, I'm quite certain since I didn't
read its source code, but after I made my own I was disappointed
that it was just as slow.
Presumably, which I also did initially, is to call a function
while iterating over the current directory to distinguish files
and directories. I used GNAT.OS_Lib.Is_Directory which binds to
the is_directory C function. This works quite fast under Unix,
but it's a big mistake under Windows. It will scan the directory
again for the same file, so for each file you will open and
close the directory over and over again.
Once this is replaced with a bit check in the file attributes
record, the one which indicates a directory, it's a hundred times
or so faster on a directory with a few thousand files!
I'm not writing a generally useful file selector because it
contains some entries with extra information for the file types
used. Once it's finished I will send a note so people can check
it for ideas. Then I can give the code too for those who are
interested in reusing some pieces and improve it.

Manuel






More information about the gtkada mailing list