From b204c440e238b560ff2a98663f66cf189dbf1a90 Mon Sep 17 00:00:00 2001 From: Valerie Wolfe Date: Tue, 16 Jul 2024 09:54:58 -0400 Subject: [PATCH] path-convert: non-canonicalized arguments are now passed through correctly --- man/path-convert.1 | 6 +++++- path-convert/Cargo.toml | 2 +- path-convert/src/main.rs | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/man/path-convert.1 b/man/path-convert.1 index 8bf0796..02f5644 100644 --- a/man/path-convert.1 +++ b/man/path-convert.1 @@ -11,7 +11,11 @@ .Sh DESCRIPTION The .Nm -utility converts UNIX paths to DOS, for command substituting paths when invoking Windows executables from the terminal in WSL. Its options are as follows: +utility converts UNIX paths to DOS, for command substituting paths when invoking Windows executables from the terminal in WSL. +.Pp +Arguments that fail to canonicalize will be passed through as-is. +.Pp +Its options are as follows: .Bl -tag -width Ds .It Fl h , Fl -help Displays a short help text. diff --git a/path-convert/Cargo.toml b/path-convert/Cargo.toml index 534da82..0370ddc 100644 --- a/path-convert/Cargo.toml +++ b/path-convert/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "path-convert" -version = "0.0.6" +version = "0.0.7" edition = "2021" [dependencies] diff --git a/path-convert/src/main.rs b/path-convert/src/main.rs index c486774..0fe2557 100644 --- a/path-convert/src/main.rs +++ b/path-convert/src/main.rs @@ -42,11 +42,12 @@ pub fn main() { // canonicalize; windows doesn't recognize symlinks let path = Path::new(&target).canonicalize(); - let mut output = + let mut output: String = if let Ok(canonical) = path { canonical.to_string_lossy().to_string() } else { - target + println!("{quotes}{target}{quotes}"); + continue; }; // handle no-space flag