Crate omnipath

source ·
Expand description

Absolute paths

sys_absolute allows you to make a path absolute without needing the path to exist. This uses the rules of the current platform.

// Makes a path absolute acording to the rules of the current OS.
// It does not resolve symlinks and on Windows it won't return a verbatim
// path unless given one.
omnipath::sys_absolute("path/to/.//file".as_ref());

Windows verbatim paths

Verbatim paths are paths that start with \\?\. For example \\?\C:\path\to\file. These paths can be used in Windows API calls but they are not what the user expects to see. You can turn these paths into more familiar user paths using the to_winuser_path.

#[cfg(windows)]
{
    use omnipath::windows::WinPathExt;
    use std::path::Path;

    let verbatim = Path::new(r"\\?\C:\path\to\file.txt");
    let user_path = verbatim.to_winuser_path();
    // user_path is Ok(r"C:\path\to\file.txt")
}

Re-exports

Modules

Functions