Function bp3d_os::fs::get_absolute_path

source ·
pub fn get_absolute_path<T: AsRef<Path>>(path: T) -> Result<PathBuf>
Available on crate feature fs only.
Expand description

Converts a path to an absolute path.

NOTE: Unlike canonicalize the paths returned by this function may not always be normalized.

Platform specific behavior

  • On Unix, this function redirects to canonicalize.

  • On Windows, contrary to canonicalize which always normalizes the input path to UNC, this function will try it’s best to avoid using UNC paths which aren’t supported by all applications, including some built-in applications. Currently, the function calls the GetFullPathNameW API.

Arguments

  • path: the path to convert.

returns: Result<PathBuf, Error>

Errors

Returns an Error if the path couldn’t be converted to an absolute path.