You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my Linux I cannot seem to convert a Windows path to a Linux path via path-slash, why is this not supported? I have a use-case where this make sense, trying to concatenate a relative path usually specified in windows path format, to a Linux root path.
use path_slash::PathExt;use std::path::Path;fnmain(){let pre = r"FOMod\CBBE.png";println!("{}", pre);let path = Path::new(pre);println!("1: {}", path.display());// suggested in the docs, but does not work either:println!("2: {}",PathBuf::from(pre).display());let supposedly_slashed = path.to_slash().unwrap();println!("3: {}", supposedly_slashed);let works = path::PathBuf::from_backslash(pre);println!("4: {}", works.display());}
output (no. 4 works, but only after my pull request)
on Linux it is possible to create a directory with a backslash mkdir "foo\\bar" so maybe some behavior in PathBuf was adapted. I've added a pull request #8 to add from_backslash() functions, which should hopefully do the job.
The text was updated successfully, but these errors were encountered:
On my Linux I cannot seem to convert a Windows path to a Linux path via path-slash, why is this not supported? I have a use-case where this make sense, trying to concatenate a relative path usually specified in windows path format, to a Linux root path.
output (no. 4 works, but only after my pull request)
Then aren't the crate and function misnomers? Path-backslash, and to_backslash() would indicate what to expect.
on Linux it is possible to create a directory with a backslash
mkdir "foo\\bar"
so maybe some behavior in PathBuf was adapted. I've added a pull request #8 to add from_backslash() functions, which should hopefully do the job.The text was updated successfully, but these errors were encountered: