mrdocs::files::isResolvedSubpathOf
Checks whether the given path lies within the specified prefix, tolerating symlinks.
Synopsis
Declared in <mrdocs/Support/Path.hpp>
bool
isResolvedSubpathOf(
std::string_view pathName,
std::string_view prefix);
Description
This behaves like isSubpathOf, but also returns true when pathName lies within prefix only after resolving symbolic links on both sides (see makeRealPath). It recognizes a file reached through a symlinked directory while prefix refers to the real path, or vice versa.
Matching is generous: a lexical match alone is enough, and resolving symlinks only ever adds matches, so anything isSubpathOf accepts is still accepted. This makes it suitable for inclusion decisions. Prefer the strict isSubpathOf for exclusion decisions, so that a symlinked alias of an excluded file is not excluded.
The symlink resolution performs filesystem lookups, so it is reached only when the lexical comparison fails; paths with no symlinks pay no extra cost.
Return Value
A boolean value. Returns true if pathName lies within prefix as written or after resolving symlinks, false otherwise.
Parameters
Name |
Description |
pathName |
A string view representing the path to be checked. |
prefix |
A string view representing the prefix to be checked against the path. |
Created with MrDocs