mrdocs::files::makeRealPath

Return the real, symlink-resolved form of a path.

Synopsis

Declared in <mrdocs/Support/Filesystem/Path.hpp>

std::string
makeRealPath(std::string_view pathName);

Description

Resolves every symbolic link and ./.. component in pathName to the file's actual on-disk location and returns it in POSIX style (forward slashes). The same file can be named by many paths (through symlinks, .., or a directory that is itself a link); this collapses all of those spellings to one real path, so two paths that refer to the same file produce the same result.

If the path cannot be resolved, for example because it does not exist on disk, is a virtual or in-memory file, or has not been created yet, the input is returned unchanged apart from POSIX normalization. Callers can therefore always fall back to comparing the path as written, and this function never fails.

Return Value

The real POSIX path, or the POSIX-normalized input if it cannot be resolved.

Parameters

NameDescription
pathNameThe absolute or relative path to a directory or file.