From 0d164708ec32b492554d99f42fbbb07af2b3dc29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 15 Jun 2017 10:04:55 +0200 Subject: [PATCH] Fix Windows->inet/Posix path conversion issue. --- source/vibe/core/path.d | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/vibe/core/path.d b/source/vibe/core/path.d index 4a7c830..680af36 100644 --- a/source/vibe/core/path.d +++ b/source/vibe/core/path.d @@ -238,8 +238,11 @@ struct Path { return ret; } else { if (m_type == PathType.windows) { - if (m_absolute) return '/' ~ this[].map!(n => n.toString()).join('/'); - else return this[].map!(n => n.toString()).join('/'); + string ret; + if (m_absolute) ret = '/' ~ this[].map!(n => n.toString()).join('/'); + else ret = this[].map!(n => n.toString()).join('/'); + if (endsWithSlash) ret ~= '/'; + return ret; } else return m_path; } } @@ -458,6 +461,7 @@ unittest assert(Path("/C:/Windows", PathType.inet).toString(PathType.windows) == "C:\\Windows"); assert((Path("/C:/Windows", PathType.inet) ~ Path("test\\this", PathType.windows)).toString() == "/C:/Windows/test/this"); assert((Path("", PathType.inet) ~ Path("foo\\bar", PathType.windows)).toString() == "foo/bar"); + assert(Path("C:\\Windows\\", PathType.windows).toString(PathType.inet) == "/C:/Windows/"); assert(Path("").empty); assert(Path("a/b/c")[1 .. 3].map!(p => p.toString()).equal(["b", "c"]));