diff options
author | David Peter <mail@david-peter.de> | 2021-08-08 12:02:57 +0200 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2021-08-08 13:03:31 +0200 |
commit | d9697d14867c59dad487bb202c23840a430a6bb0 (patch) | |
tree | 487c3a357971b3742e5da5505655ee869cbb384d | |
parent | 515e0ee4693812626b70f95f1ca4e88cdaefd10a (diff) |
Make the path-separator check Windows-only
-rw-r--r-- | src/main.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index dae2aa7..8a315a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -177,18 +177,21 @@ fn run() -> Result<ExitCode> { .value_of("path-separator") .map_or_else(filesystem::default_path_separator, |s| Some(s.to_owned())); - if let Some(ref sep) = path_separator { - if sep.len() > 1 { - return Err(anyhow!( - "A path separator must be exactly one byte, but \ + #[cfg(windows)] + { + if let Some(ref sep) = path_separator { + if sep.len() > 1 { + return Err(anyhow!( + "A path separator must be exactly one byte, but \ the given separator is {} bytes: '{}'.\n\ In some shells on Windows, '/' is automatically \ expanded. Try to use '//' instead.", - sep.len(), - sep - )); + sep.len(), + sep + )); + }; }; - }; + } let ls_colors = if colored_output { Some(LsColors::from_env().unwrap_or_else(|| LsColors::from_string(DEFAULT_LS_COLORS))) |