zng_task::fs

Function canonicalize

pub async fn canonicalize<P>(path: P) -> Result<PathBuf, Error>
where P: AsRef<Path>,
Expand description

Returns the canonical form of a path.

The returned path is in absolute form with all intermediate components normalized and symbolic links resolved.

§Errors

An error will be returned in the following situations:

  • path does not point to an existing file or directory.
  • A non-final component in path is not a directory.
  • Some other I/O error occurred.

§Examples

let path = async_fs::canonicalize(".").await?;