logo
pub async fn canonicalize<P: AsRef<Path>>(path: P) -> Result<PathBuf>
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.

This function is an async version of std::fs::canonicalize.

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

use async_std::fs;

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