flowey_lib_common/_util/
wslpath.rs1use std::path::Path;
5use std::path::PathBuf;
6
7pub fn win_to_linux(path: impl AsRef<Path>) -> PathBuf {
8 let sh = xshell::Shell::new().unwrap();
9 let path = path.as_ref();
10 xshell::cmd!(sh, "wslpath {path}")
11 .quiet()
12 .ignore_status()
13 .read()
14 .unwrap()
15 .into()
16}
17
18pub fn linux_to_win(path: impl AsRef<Path>) -> PathBuf {
19 let sh = xshell::Shell::new().unwrap();
20 let path = path.as_ref();
21 xshell::cmd!(sh, "wslpath -aw {path}")
22 .quiet()
23 .ignore_status()
24 .read()
25 .unwrap()
26 .into()
27}