Function path_to_string

Source
pub fn path_to_string(path: PathBuf) -> String
Expand description

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

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.