www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4006] New: dirEntries won't span subdirectories

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: Jesse.K.Phillips+D gmail.com
                CC: Jesse.K.Phillips+D gmail.com


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D 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: -------
Mar 25 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4006


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: -------
Mar 25 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4006


Jesse Phillips <Jesse.K.Phillips+D gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Linux                       |All


--- Comment #1 from Jesse Phillips <Jesse.K.Phillips+D gmail.com> 2010-03-26
10:43:12 PDT ---
I just found this  Issue 2838 -  std.file.rmdirRecurse fails

And it mentions the problem occurs with reiserfs which I use on Linux. Though I
also tested it on Windows with NTFS and the test still fails.

It is likely that the issue on Linux is a duplicate of the above issue, but on
Windows it may, or may not be a duplicate of the issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 26 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4006


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh gmail.com


--- Comment #2 from Dmitry Olshansky <dmitry.olsh gmail.com> 2012-02-24
11:39:06 PST ---
Well I know why it fails on Windows... so damn simple :)
dirEntries returns paths with backslashes on Windows which is expected for this
OS anywa., So, of course, regex fails to find Hello/there/you hence the
assertion.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4006


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |thecybershadow gmail.com
         Resolution|                            |WORKSFORME


--- Comment #3 from Vladimir Panteleev <thecybershadow gmail.com> 2012-12-21
21:20:05 PST ---
Works on Linux in DMD 2.060. Is expected to fail on Windows per Dmitry's
comment. OP did not specify platform... Closing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 21 2012