From 545bb55e769593b6fa0fede66a4440828534dbfc Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Wed, 14 Oct 2015 23:38:03 +0000 Subject: [PATCH] fix Issue 15146 - std.file.dirEntries("") only works on Windows --- std/file.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/std/file.d b/std/file.d index d9662ef3f..0a5332bca 100644 --- a/std/file.d +++ b/std/file.d @@ -3142,7 +3142,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(); } @@ -3410,6 +3411,9 @@ unittest // issue 11392 auto dFiles = dirEntries(testdir, SpanMode.shallow); foreach(d; dFiles){} + + // issue 15146 + dirEntries("", SpanMode.shallow).walkLength(); } /++