Crates.io | wslpath |
lib.rs | wslpath |
version | 0.0.2 |
source | src |
created_at | 2021-09-15 20:12:42.345182 |
updated_at | 2021-09-16 07:31:46.827566 |
description | Convert Windows to WSL Path and vice-versa |
homepage | https://github.com/pratikpc/wsl-path-rust#readme |
repository | https://github.com/pratikpc/wsl-path-rust |
max_upload_size | |
id | 451968 |
size | 8,735 |
You can use WSLPath to convert a WSL Path to a Windows Path and vice versa
Calls wslpath which is a Linux based utility created by Microsoft to convert Windows and Linux paths.
We call wslpath, pass arguments, perform a conversion and return the results to the user
fn main() {
let path = wslpath::windows_to_wsl("C:\\Users").unwrap();
println!("Windows Path converted to WSL is {}",path);
}
Windows Path converted to WSL is /mnt/c/Users
fn main() {
let path = wslpath::wsl_to_windows("/mnt/c/Users").unwrap();
println!("WSL Path converted to Windows is {}",path);
}
WSL Path converted to Windows is C:/Users
In this case we are using Ubuntu
fn main() {
let path = wslpath::windows_to_wsl_with_distro("C:\\Users", "Ubuntu".to_string()).unwrap();
println!("Windows Path converted to WSL is {}", path);
}
Windows Path converted to WSL is /mnt/c/Users
In this case we are using Ubuntu
fn main() {
let path = wslpath::wsl_to_windows_with_distro("/mnt/c/Users", "Ubuntu".to_string()).unwrap();
println!("WSL Path converted to Windows is {}", path);
}
WSL Path converted to Windows is C:/Users