Skip to content

Commit

Permalink
Make the path-separator check Windows-only
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Aug 8, 2021
1 parent 515e0ee commit d9697d1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit d9697d1

Please sign in to comment.