pub fn canonicalize_or<T: AsPath + ?Sized>(path: &T, or_value: &str) -> String
Expand description

Returns a canonicalized string from the provided path value.

Arguments

  • path - The path value

Example

use fsio::path;
use fsio::path::as_path::AsPath;
use std::path::Path;

fn main() {
    let path_obj = Path::new("./src/path/mod.rs");

    let path1 = path::canonicalize_as_string(&path_obj);
    let path2 = path::canonicalize_or("./src/path/mod.rs", "/src/path/mod.rs");

    assert_eq!(path1.unwrap(), path2);
}