SpanMode uses incorrect terminology (breadth)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Sep 17 11:21:42 PDT 2012


On 9/17/12 1:30 AM, Jesse Phillips wrote:
>
>> What would be an example illustrating that "breadth" is doing the
>> wrong thing?
>>
>> Andrei
>
> Linux 64bit:
>
> import std.file;
> import std.stdio;
>
> void main() {
> mkdir("a");
> mkdir("a/b");
> mkdir("a/c");
> mkdir("a/c/z");
> std.file.write("a/1.txt", "");
> std.file.write("a/2.txt", "");
> std.file.write("a/b/1.txt", "");
> std.file.write("a/b/2.txt", "");
> std.file.write("a/c/1.txt", "");
> std.file.write("a/c/z/1.txt", "");
> foreach(string file; dirEntries("a/", SpanMode.breadth))
> writeln(file);
>
> rmdirRecurse("a");
> // Expected Approximation
> // a/2.txt
> // a/1.txt
> // a/b
> // a/c
> // a/c/1.txt
> // a/c/z
> // a/c/z/1.txt
> // a/b/1.txt
> // a/b/2.txt
> //
> // Actual
> // a/c
> // a/c/z
> // a/c/z/1.txt
> // a/c/1.txt
> // a/b
> // a/b/2.txt
> // a/b/1.txt
> // a/2.txt
> // a/1.txt
> }
>

Thanks, that does seem to be a bug. Please make sure it's in bugzilla. 
Probably the best way to go is to adjust the behavior so it matches the 
specification.

Andrei


More information about the Digitalmars-d mailing list