Bug 17962 – dirEntries now truncates Unicode file names
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-11-03T04:46:18Z
Last change time
2018-12-12T11:11:18Z
Assigned to
No Owner
Creator
Jonathan M Davis
Comments
Comment #0 by issues.dlang — 2017-11-03T04:46:18Z
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).