[Issue 3414] New: std.file.listdir: Use regex, not RegExp
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 17 14:42:47 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3414
Summary: std.file.listdir: Use regex, not RegExp
Product: D
Version: 2.035
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: patch
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: dsimcha at yahoo.com
--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2009-10-17 14:42:45 PDT ---
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;
}
--
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