std.file.dirEntries unsorted

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Tue Dec 10 23:00:27 PST 2013


On Wednesday, 11 December 2013 at 02:11:51 UTC, Timothee Cour 
wrote:
> dirEntries depends on readdir, which has undefined order (eg:
> http://stackoverflow.com/questions/8977441/does-readdir-guarantee-an-order,
> and I've experienced as well dirEntries in non-alphabetical 
> order)
>
> shouldn't we make dirEntries return in alphabetical order by 
> default, with
> an option to return in unspecified native order for efficiency?
>
> at least, it should be specified in doc that order is undefined.

It should only be documented. In my experience processing files 
don't need a particular order and sorting may not be needed by 
name.

Returning a sorted directory is difficult to define, should 
directories come first or be mixed with the files. Is uppercase 
grouped together? Does A come before a. Should the extension be 
included or postponed for later.

I think sorting should be explicit.


More information about the Digitalmars-d-learn mailing list