string of transformed path
Exception if the specified base directory is not absolute.
version (Posix) { assert(absolutePath("some/file", "/foo/bar") == "/foo/bar/some/file"); assert(absolutePath("../file", "/foo/bar") == "/foo/bar/../file"); assert(absolutePath("/some/file", "/foo/bar") == "/some/file"); } version (Windows) { assert(absolutePath(`some\file`, `c:\foo\bar`) == `c:\foo\bar\some\file`); assert(absolutePath(`..\file`, `c:\foo\bar`) == `c:\foo\bar\..\file`); assert(absolutePath(`c:\some\file`, `c:\foo\bar`) == `c:\some\file`); assert(absolutePath(`\`, `c:\`) == `c:\`); assert(absolutePath(`\some\file`, `c:\foo\bar`) == `c:\some\file`); }
asAbsolutePath which does not allocate
Transforms path into an absolute path.
The following algorithm is used:
The function allocates memory if and only if it gets to the third stage of this algorithm.
Note that absolutePath will not normalize .. segments. Use buildNormalizedPath(absolutePath(path)) if that is desired.