Thread overview
[Issue 4006] New: dirEntries won't span subdirectories
Mar 26, 2010
Jesse Phillips
Mar 26, 2010
Jesse Phillips
Feb 24, 2012
Dmitry Olshansky
Dec 22, 2012
Vladimir Panteleev
March 26, 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@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: -------
March 26, 2010
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: -------
March 26, 2010
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: -------
February 24, 2012
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: -------
December 22, 2012
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: -------