Function std::fs::canonicalize [] [src]

pub fn canonicalize<P: AsRef<Path>>(path: P) -> Result<PathBuf>

Returns the canonical form of a path with all intermediate components normalized and symbolic links resolved.

This function may return an error in situations like where the path does not exist, a component in the path is not a directory, or an I/O error happens.

Examples

fn main() { use std::fs; fn foo() -> std::io::Result<()> { let path = try!(fs::canonicalize("../a/../foo.txt")); Ok(()) } }
use std::fs;

let path = try!(fs::canonicalize("../a/../foo.txt"));