relativeTo

Computes the relative path from base_path to this path.

@safe
relativeTo

Parameters

path Path

The destination path

base_path Path

The path from which the relative path starts

Examples

assert(Path("/some/path").relativeTo(Path("/")) == Path("some/path"));
assert(Path("/some/path/").relativeTo(Path("/some/other/path/")) == Path("../../path/"));
assert(Path("/some/path/").relativeTo(Path("/some/other/path")) == Path("../../path/"));

See Also

relativeToWeb

Meta