diff --git a/std/file.d b/std/file.d index 5bbec5883..2879d57fa 100644 --- a/std/file.d +++ b/std/file.d @@ -3417,7 +3417,8 @@ private struct DirIteratorImpl 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)); return next(); } @@ -3685,6 +3686,9 @@ unittest // issue 11392 auto dFiles = dirEntries(testdir, SpanMode.shallow); foreach(d; dFiles){} + + // issue 15146 + dirEntries("", SpanMode.shallow).walkLength(); } /++