www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17962] New: dirEntries now truncates Unicode file names

https://issues.dlang.org/show_bug.cgi?id=17962

          Issue ID: 17962
           Summary: dirEntries now truncates Unicode file names
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: issues.dlang jmdavisProg.com

Thanks to https://github.com/dlang/phobos/pull/5758 (which I _think_ is just on
master and didn't make it into 2.077), std.file.dirEntries can no longer handle
Unicode file names. It now incorrectly combines countUntil with slicing a
string, and Unicode names get truncated.

For instance, if you do something like

foreach(de; dirEntries("foo", SpanMode.shallow))
{
    if(de.isDir)
    {
    }
}

and the directory foo contains a file name with Unicode characters, then isDir
will throw a FileException, because de.name does not actually exist (since the
file's name was truncated).

--
Nov 02 2017