Skip to main content

path_to_absolute_path

Function path_to_absolute_path 

Source
pub fn path_to_absolute_path(path: &Path, strip_prefix: bool) -> PathBuf
Expand description

Converts a path to an absolute PathBuf, optionally stripping Windows UNC prefix.

This function canonicalizes the path and optionally removes the Windows \\?\ prefix. If canonicalization fails (e.g., path doesn’t exist), it returns the path as-is.

§Arguments

  • path - The path to convert
  • strip_prefix - If true, removes the Windows \\?\ prefix

§Returns

Returns the absolute path, with Windows UNC prefix removed if strip_prefix is true.