diff --git a/path-convert/src/main.rs b/path-convert/src/main.rs index 74ed50b..371de80 100644 --- a/path-convert/src/main.rs +++ b/path-convert/src/main.rs @@ -11,7 +11,7 @@ pub fn main() { let next = args.subcommand().unwrap(); if let Some(arg) = next { let mut output: String; - // resolve symlinks, etc. + // canonicalize; windows doesn't recognize symlinks let path = Path::new(&arg).canonicalize(); if let Ok(target) = path { output = target.to_string_lossy().to_string(); @@ -19,12 +19,15 @@ pub fn main() { output = arg; } + // simple C-drive substitution if output.starts_with(DRIVE) { output = output.replace(DRIVE, "C:\\"); } + // switch out separators output = output.replace("/", "\\"); + // emit to stdout println!("{output}"); } else { break;