to_absolute_string

Function to_absolute_string 

Source
pub fn to_absolute_string<P>(path: P) -> String
where P: Into<PathBuf> + Clone,
Expand description

Converts a PathBuf into a String representation of the absolute path.

Uses fs::canonicalize, which might cause problems on Windows

This function attempts to canonicalize the provided path, which resolves any symbolic links and returns an absolute path. If canonicalization fails, the original path is returned as a string.

§Arguments

  • path - A PathBuf representing the file system path to be converted.

§Returns

A String containing the absolute path if canonicalization succeeds, or the original path as a string otherwise.