pub fn canonicalize<P: AsRef<Path>>(
original: P,
miss_mode: MissingHandling,
res_mode: ResolveMode,
) -> Result<PathBuf>Expand description
Return the canonical, absolute form of a path.
This function is a generalization of std::fs::canonicalize that
allows controlling how symbolic links are resolved and how to deal
with missing components. It returns the canonical, absolute form of
a path.
The miss_mode parameter controls how missing path elements are handled
MissingHandling::Normalmakes this function behave likestd::fs::canonicalize, resolving symbolic links and returning an error if the path does not exist.MissingHandling::Missingmakes this function ignore non-final components of the path that could not be resolved.MissingHandling::Existingmakes this function return an error if the final component of the path does not exist.
The res_mode parameter controls how symbolic links are
resolved:
ResolveMode::Nonemakes this function not try to resolve any symbolic links.ResolveMode::Physicalmakes this function resolve symlinks as they are encounteredResolveMode::Logicalmakes this function resolve ‘..’ components before symlinks