CreateRelativePath function
Gets the relative path from BaseDirectory to Filename.
Declaration
function CreateRelativePath(const Filename: string;
const BaseDirectory: string;
UsePointDirectory: Boolean=False;
AlwaysRequireSharedBaseFolder: Boolean=True)
: stringDescription
CreateRelativePath is a
String function used to get the
relative path from
BaseDirectory to
Filename. A
trailing path delimiter in BaseDirectory is ignored. If there is no relative
path, the value in Filename is returned.
When BaseDirectory and Filename contain the same value, and
UsePointDirectory is False, an empty string ('') is
used as the return value. If UsePointDirectory contains True, the
return value is the '.' character. Duplicate path delimiters are removed.
CreateRelativePath is thread safe, and therefore, does not guarantee that the
current directory is correct for file names like 'D:test.txt'.
See also
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
