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