forked from pratikpc/wsl-path-rust
-
Notifications
You must be signed in to change notification settings - Fork 1
/
convert.rs
24 lines (21 loc) · 844 Bytes
/
convert.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use wslpath2::{convert, Conversion};
fn main() {
// Convert Windows path to WSL
let path = convert("C:\\Users", None, Conversion::WindowsToWsl, false).unwrap();
println!("Windows Path converted to WSL is {}", path);
// OUTPUT is Windows Path converted to WSL is /mnt/c/Users
// Convert WSL path to Windows
let path = convert("/mnt/c/Users", None, Conversion::WslToWindows, false).unwrap();
println!("WSL Path converted to Windows is {}", path);
// OUTPUT is WSL Path converted to Windows is C:\Users
// Convert WSL path to Windows Linux Style
let path = convert(
"/mnt/c/Users",
None,
Conversion::WslToWindowsLinuxStyle,
false,
)
.unwrap();
println!("WSL Path converted to Windows is {}", path);
// OUTPUT is WSL Path converted to Windows is C:/Users
}