Bug 3414 – std.file.listdir: Use regex, not RegExp

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-10-17T14:42:00Z
Last change time
2015-06-09T01:26:56Z
Keywords
patch
Assigned to
andrei
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2009-10-17T14:42:45Z
std.file.listdir still uses the old-school std.regexp lib, even though this will likely be deprecated soon. Here's a version using the new-school std.regex. string[] listdir(Char)(in char[] pathname, Regex!(Char) r) { Appender!(string[]) result; bool callback(DirEntry* de) { if (de.isdir) listdir(de.name, &callback); else { if (!match(de.name, r).empty) result.put(de.name); } return true; // continue } listdir(pathname, &callback); return result.data; }
Comment #1 by andrej.mitrovich — 2011-05-26T13:31:52Z
Since listdir is deprecated now, I think it's safe to close this. The leftover import to std.regexp should be removed once listdir is removed, since the rest of the module doesn't use it. P.S. We really need an "OUTDATED" as a reason in the RESOLVED section. :)