Crate realpath

source ·
Expand description

Usage

#no_run

use crate::realpath::realpath; 
use std::path::PathBuf; 
let src = PathBuf::from("Cargo.toml");
let dest : PathBuf = realpath(&src)?; 
println!("{} -> {}", src.display(), dest.display()); 

Functions

  • Takes a PathBuf as input Normalizes it, removes any trailing slashes, intermediate dots, and such Traces symlinks and processes as far as can be canonicalized If only a part of the path is canonicalize-able, then the remaining part is appended as is to the canonicalized part Returns the canonicalized path as a PathBuf Returns an Error if there is some problem with absolutization/canonicalization Error => std::io::Error Only convern : Returns \?\Drive:\path\to\file instead of Drive:\path\to\file on Windows