mirror of https://github.com/sharkdp/fd.git
Make the path-separator check Windows-only
This commit is contained in:
parent
515e0ee469
commit
d9697d1486
19
src/main.rs
19
src/main.rs
|
@ -177,18 +177,21 @@ fn run() -> Result<ExitCode> {
|
||||||
.value_of("path-separator")
|
.value_of("path-separator")
|
||||||
.map_or_else(filesystem::default_path_separator, |s| Some(s.to_owned()));
|
.map_or_else(filesystem::default_path_separator, |s| Some(s.to_owned()));
|
||||||
|
|
||||||
if let Some(ref sep) = path_separator {
|
#[cfg(windows)]
|
||||||
if sep.len() > 1 {
|
{
|
||||||
return Err(anyhow!(
|
if let Some(ref sep) = path_separator {
|
||||||
"A path separator must be exactly one byte, but \
|
if sep.len() > 1 {
|
||||||
|
return Err(anyhow!(
|
||||||
|
"A path separator must be exactly one byte, but \
|
||||||
the given separator is {} bytes: '{}'.\n\
|
the given separator is {} bytes: '{}'.\n\
|
||||||
In some shells on Windows, '/' is automatically \
|
In some shells on Windows, '/' is automatically \
|
||||||
expanded. Try to use '//' instead.",
|
expanded. Try to use '//' instead.",
|
||||||
sep.len(),
|
sep.len(),
|
||||||
sep
|
sep
|
||||||
));
|
));
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
let ls_colors = if colored_output {
|
let ls_colors = if colored_output {
|
||||||
Some(LsColors::from_env().unwrap_or_else(|| LsColors::from_string(DEFAULT_LS_COLORS)))
|
Some(LsColors::from_env().unwrap_or_else(|| LsColors::from_string(DEFAULT_LS_COLORS)))
|
||||||
|
|
Loading…
Reference in New Issue