Merge pull request #3690 from CyberShadow/pull-20151003-171210

fix Issue 15146 - std.file.dirEntries("") only works on Windows
This commit is contained in:
Andrei Alexandrescu 2015-11-15 19:44:58 -05:00
commit 32b51aed4f

View file

@ -3417,7 +3417,8 @@ private struct DirIteratorImpl
bool stepIn(string directory) bool stepIn(string directory)
{ {
auto h = cenforce(opendir(directory.tempCString()), directory); auto h = directory.length ? opendir(directory.tempCString()) : opendir(".");
cenforce(h, directory);
_stack.put(DirHandle(directory, h)); _stack.put(DirHandle(directory, h));
return next(); return next();
} }
@ -3685,6 +3686,9 @@ unittest
// issue 11392 // issue 11392
auto dFiles = dirEntries(testdir, SpanMode.shallow); auto dFiles = dirEntries(testdir, SpanMode.shallow);
foreach(d; dFiles){} foreach(d; dFiles){}
// issue 15146
dirEntries("", SpanMode.shallow).walkLength();
} }
/++ /++