www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3414] New: std.file.listdir: Use regex, not RegExp

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha 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: -------
Oct 17 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3414


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 17 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3414


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |WONTFIX


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-05-26
13:31:52 PDT ---
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. :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 26 2011