Parsing cross-platform paths


#1

I’m working on a unix app where I have to deal with windows paths, and would love to use Path API to manipulate them. There doesn’t seem to be an obvious way to tell Path to parse a string as if it were Windows path. Is there a way to do so?


#2

I only know of RelativePath crate for Unix paths.

You could try cloning Rust source code and copying Windows path code from libstd. The code might be a bit weird, since it’s portable + optimized and spread over a few files. Rust is on permissive license, and the paths code should be mature by now, so there’s no problem just copying the code from there.