8 releases

0.1.6 May 12, 2023
0.1.5 Mar 25, 2023
0.1.1 Oct 20, 2022
0.0.0 Sep 27, 2022

#152 in Filesystem

Download history 797/week @ 2023-02-10 1046/week @ 2023-02-17 2547/week @ 2023-02-24 1142/week @ 2023-03-03 1567/week @ 2023-03-10 1321/week @ 2023-03-17 1273/week @ 2023-03-24 1562/week @ 2023-03-31 1342/week @ 2023-04-07 1370/week @ 2023-04-14 1337/week @ 2023-04-21 1318/week @ 2023-04-28 940/week @ 2023-05-05 1438/week @ 2023-05-12 1465/week @ 2023-05-19 1353/week @ 2023-05-26

5,429 downloads per month
Used in 33 crates (via nu-path)

MIT/Apache

46KB
806 lines

A path handling library for Rust. See the api docs!

Quick tour

The sys_absolute function is similar to std::fs::canonicalize but doesn't require accessing the filesystem.

// Normalizes the path and makes it absolute.
// On Windows platforms this will use `\` as the path separator.
let absolute = omnipath::sys_absolute("path/to/.//file".as_ref());

The sys_canonicalize function is almost the same std::fs::canonicalize except that it will try to return an non-verbatim path on Windows.

// On Windows this returns r"C:\path\to\file" instead of `\\?\C:\path\file`
let canonical = omnipath::sys_absolute(r"C:\path\to\file".as_ref());

Platform-specific functions

The traits PosixPathExt and WinPathExt provide platform specific extension traits for std::path::Path. For example, on Windows they allow converting to a user path (useful for displaying a path to the user without the \\?\ part) or as a verbatim path

No runtime deps

Features

  • std