[Issue 4006] New: dirEntries won't span subdirectories
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 25 19:43:27 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4006
Summary: dirEntries won't span subdirectories
Product: D
Version: 2.041
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: Jesse.K.Phillips+D at gmail.com
CC: Jesse.K.Phillips+D at gmail.com
--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D at gmail.com> 2010-03-25 19:43:25 PDT ---
The code below creates the folders and file Hello/there/you it then checks that
that string appears in on of the names returned when using dirEntries. The
result is that the loop is never given that filename.
-----------------------
import std.file;
import std.regex;
void main() {
auto all = ["Hello",
"Hello/there"];
foreach(dir; all) {
mkdir(dir);
}
write(all[1] ~ "/you", "Make me feel");
assert(exists(all[1] ~ "/you"), "you don't exist");
scope(exit) {
remove(all[1] ~ "/you");
foreach(dir; all)
if(exists(dir))
rmdirRecurse(dir);
}
bool found = false;
foreach(string name; dirEntries(".", SpanMode.depth)) {
if(!match(name, regex(all[1] ~ "/you")).empty)
found = true;
}
assert(found, "Missing File");
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list