mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 15:40:36 +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:
|
Throws:
|
||||||
$(D Exception) if the specified _base directory is not absolute.
|
$(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
|
@safe pure
|
||||||
{
|
{
|
||||||
if (path.empty) return null;
|
if (path.empty) return null;
|
||||||
if (isAbsolute(path)) return path;
|
if (isAbsolute(path)) return path;
|
||||||
const baseVar = base;
|
immutable baseVar = base;
|
||||||
if (!isAbsolute(baseVar)) throw new Exception("Base directory must be absolute");
|
if (!isAbsolute(baseVar)) throw new Exception("Base directory must be absolute");
|
||||||
return buildPath(baseVar, path);
|
return buildPath(baseVar, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
version (Posix)
|
version (Posix)
|
||||||
|
@ -2020,13 +2021,7 @@ unittest
|
||||||
assertThrown(absolutePath("bar", "foo"));
|
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.
|
/** Translates $(D path) into a relative _path.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue