Pathx - path utilities for Rust

pathx is a cross-platform Rust crate offering intiuitive utilities for working with paths. It’s made to complement std::path, not replace it—focusing on operations that purely lexical.

The crate includes functions like join, relative_to, is_subpath, and strip_root, along with a macro for path templating. These utilities simplify path manipulations without relying on access to the filesystem

Links
crates.io
github repo

Install
Run cargo add pathx
Example

use pathx::{join, join_lossy};
use std::path::Path;

fn main() {
    // Joining paths
    let base = Path::new("/foo/bar");
    let segment = Path::new("../baz");
    let result = join(base, segment).unwrap();
    println!("{result:?}");

    // Joining paths (lossy)
    let lossy_result = join_lossy(base, segment);
    println!("{lossy_result:?}");
}

More examples are available here.

Feedback and contributions are welcome.

1 Like

Hello, @Pjdur

Nice If You Publish This to Cargo Become Very Powerful Tool in Rust EcoSystem

It's published to Cargo.
You can install it with cargo add pathx

1 Like

Nice If you Publish To Cargo Will be Popular i Love Rust Because Memory Safe Language utilities Anyone can install easily with

~$ cargo add pathx

As I said, it's published to crates. If you have any other questions you can ask.

1 Like

Yes You Are Published It And I Test it I see Work Correctly and Fine and Have Powerful Feature

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.