From 6f7c897f915c5635a63e104d5144be98dadc0989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Mon, 12 Jun 2017 17:31:52 +0200 Subject: [PATCH] Fix getFileInfo name return value for paths that end with a slash. --- source/vibe/core/file.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/vibe/core/file.d b/source/vibe/core/file.d index 3ef2295..cd96b0b 100644 --- a/source/vibe/core/file.d +++ b/source/vibe/core/file.d @@ -672,9 +672,9 @@ struct DirectoryChange { private FileInfo makeFileInfo(DirEntry ent) @trusted { FileInfo ret; - ret.name = baseName(ent.name); - if( ret.name.length == 0 ) ret.name = ent.name; - assert(ret.name.length > 0); + auto fullname = ent.name.endsWith('/') || ent.name.endsWith('\\') ? ent.name[0 .. $-1] : ent.name; + ret.name = baseName(fullname); + if (ret.name.length == 0) ret.name = fullname; ret.size = ent.size; ret.timeModified = ent.timeLastModified; version(Windows) ret.timeCreated = ent.timeCreated;