So Rust's PathBuf/Utf8PathBuf handles a lot of the complexities of system paths for you, but trying to send a relative path over the network with e.g. the default serde impl is gonna cause trouble right?

Is there established best practices here?

Thinking about e.g. a webservice that returns various details about some git repo. Service could be running on linux/windows while the client is on a completely different system.

@Gankra The typed_path crate helps some, by letting you explicitly choose to work with Windows or Unix paths regardless of what's native on your platform.

Here's the code I came up with to work with paths when unpacking redistributable packages; feel free to steal anything useful. It errors on the side of rejecting funny business rather than trying to support every possible situation – that might or might not be what you want.
https://github.com/njsmith/posy/blob/main/src/tree.rs

posy/tree.rs at main · njsmith/posy

Contribute to njsmith/posy development by creating an account on GitHub.

GitHub