www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - bug in std.file.listdir (fix included)

reply Nick <Nick_member pathlink.com> writes:
Runnig the following:

# bool callback(DirEntry* de)
# {
#   writefln(de.name, " ", de.size);
#   return true;
# }
# listdir(".", &callback);

will output bogus sizes for all the files except the first. It would also do the
same for access times, etc. The bug lies in the 'lazy' evaluation of stat()
found in the linux version of the DirEntry struct. To fix it, add the line

didstat = 0;

to DirEntry.init(), found at line 1126 of std/file.d.

Feb 20 2006
parent "Walter Bright" <newshound digitalmars.com> writes:
You're right, I'll fold in the fix. 
Feb 20 2006