filenameName

fnstring filenameName(string path) @trusted

Gets the filename portion of a path.

Returns the part of the path after the last directory separator. If no separator is found, returns the entire path.

Parameters

pathFull path to extract filename from

Returns

The filename portion of the path, or the entire path if no

directory separator is found.

Example:

assert(filenameName("/usr/lib") == "lib");
assert(filenameName("/usr/") == "");
assert(filenameName("file.txt") == "file.txt");