filenameRelative

fnstring filenameRelative(string path) @trusted

Converts an absolute path to a relative path.

Creates a path relative to the current working directory.

Parameters

pathAbsolute path to convert

Returns

The relative path, or the original path if conversion failed.

Example:

import std.file : getcwd;
auto cwd = getcwd();
auto rel = filenameRelative(cwd);
assert(rel == ".");