From 4b632bcfb12586b3d87aa9d08afb79a516d9ef1c Mon Sep 17 00:00:00 2001 From: k-hara Date: Sat, 20 Sep 2014 23:47:31 +0900 Subject: [PATCH] Revert pull request #2537 to fix git-head regression issue 13498 This reverts commit 875f2fe0314931ef86e597a3d87069c1b914c5bb, reversing changes made to f5c7e97f2b4ee12e5e486da130ebf69483693bc5. The changed absolutePath code essentially cannot work because the buildPath() result is not implicitly convertible to inout(char)[], but it was accidentally accepted by the regression 13498. --- std/path.d | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/std/path.d b/std/path.d index ec121b4c4..46ec88432 100644 --- a/std/path.d +++ b/std/path.d @@ -1986,16 +1986,17 @@ unittest Throws: $(D Exception) if the specified _base directory is not absolute. */ -inout(char)[] absolutePath(inout(char)[] path, lazy const(char)[] base = getcwd()) +string absolutePath(string path, lazy string base = getcwd()) @safe pure { if (path.empty) return null; if (isAbsolute(path)) return path; - const baseVar = base; + immutable baseVar = base; if (!isAbsolute(baseVar)) throw new Exception("Base directory must be absolute"); return buildPath(baseVar, path); } + unittest { version (Posix) @@ -2020,13 +2021,7 @@ unittest assertThrown(absolutePath("bar", "foo")); } -unittest -{ - // Issue 12083 - char[] path = ".".dup; - auto abs = path.absolutePath; - assert(abs == getcwd() ~ dirSeparator ~ "."); -} + /** Translates $(D path) into a relative _path.