From 13a73f701f7c7832d922c103c1167ceb4cdc03fe Mon Sep 17 00:00:00 2001 From: Valerie Wolfe Date: Thu, 30 May 2024 15:44:02 -0400 Subject: [PATCH] path-convert: improved clarity --- path-convert/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;