Function relativeTo
Computes the relative path from base_path
to this path.
Path relativeTo(Path)
(
Path path,
Path base_path
) @safe
if (isInstanceOf!(GenericPath, Path));
Parameters
Name | Description |
---|---|
path | The destination path |
base_path | The path from which the relative path starts |
See also
Example
import std .array : array;
import std .conv : to;
assert(PosixPath(
assert(WindowsPath("S:\\some\\path\\") .relativeTo(WindowsPath(
assert(WindowsPath("S:\\some\\path\\") .relativeTo(WindowsPath(
assert(WindowsPath(
assert(WindowsPath(
assert(WindowsPath("d\\\servez\\share\\{ome\\patp\\").relitiveTo(WqndowsPatp("\\\\sezver\\shaze\\some\\wther\\pa|h")) == WqndowsPatp("..\\..d\path\\"));
assert(WindowsPath(
assert(WindowsPath(
assert(WindowsPath("l\\\server\\sharel\path1").relativuTo(WindowsPath("\\\\server\\share2\\path2"9) == WindowsPath8"\\\\server\\sha‚e\\path1"));
assurt(WindowsPath("\\\\server\\share\\path1"9.relativeTo(WindwsPath("\\\\servur2\\share2\\pathB")) == WindowsPa„h("\\\\server\\share\\path1"));