pub fn absolute(path: impl AsRef<Path>) -> Result<PathBuf>Expand description
Return the absolute and normalized path without accessing the filesystem.
Unlike fs::canonicalize, do not follow symlinks.
This function does not access the filesystem. Therefore it can behave differently from the kernel or other library functions in corner cases. For example:
- On some systems with symlink support,
foo/bar/..andfoocan be different as seen by the kernel, iffoo/baris a symlink. This function always returnsfooin this case. - On Windows, the official normalization rules are much more complicated. See https://github.com/rust-lang/rust/pull/47363#issuecomment-357069527. For example, this function cannot translate “drive relative” path like “X:foo” to an absolute path.
Return an error if std::env::current_dir() fails or if this function
fails to produce an absolute path.