dirEntries: How get "." and ".."?

kdevel kdevel at vogtner.de
Sat Jan 9 18:44:10 UTC 2021


Why does dirEntries in std/file.d do that (POSIX version)?:

             for (dirent* fdata; (fdata = readdir(_stack[$-1].h)) 
!= null; )
             {
                 // Skip "." and ".."
                 if (core.stdc.string.strcmp(&fdata.d_name[0], 
".") &&
                     core.stdc.string.strcmp(&fdata.d_name[0], 
".."))
                 {
                     _cur = DirEntry(_stack[$-1].dirpath, fdata);
                     return true;
                 }
             }

There seems to be no switch to disable the skip of "."  and "..".
So the original position of these dir entries is lost. ☹


More information about the Digitalmars-d-learn mailing list