mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 14:10:30 +03:00
Revert pull request #2537 to fix git-head regression issue 13498
This reverts commit875f2fe031
, reversing changes made tof5c7e97f2b
. 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.
This commit is contained in:
parent
2ad0698308
commit
4b632bcfb1
1 changed files with 4 additions and 9 deletions
13
std/path.d
13
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue