diff --git a/crates/nu-cli/src/completion/path.rs b/crates/nu-cli/src/completion/path.rs index 670d30e65..0d0866b95 100644 --- a/crates/nu-cli/src/completion/path.rs +++ b/crates/nu-cli/src/completion/path.rs @@ -15,7 +15,8 @@ pub struct PathSuggestion { impl PathCompleter { pub fn path_suggestions(&self, partial: &str, matcher: &dyn Matcher) -> Vec { let expanded = nu_parser::expand_ndots(partial); - let expanded = expanded.as_ref(); + let expanded = expanded.replace(std::path::is_separator, &SEP.to_string()); + let expanded: &str = expanded.as_ref(); let (base_dir_name, partial) = match expanded.rfind(SEP) { Some(pos) => expanded.split_at(pos + SEP.len_utf8()), diff --git a/crates/nu-command/src/commands/run_external.rs b/crates/nu-command/src/commands/run_external.rs index 6b231b6a2..9f4790da6 100644 --- a/crates/nu-command/src/commands/run_external.rs +++ b/crates/nu-command/src/commands/run_external.rs @@ -143,7 +143,7 @@ async fn maybe_autocd_dir<'a>( // - the command name ends in a path separator, or // - it's not a command on the path and no arguments were given. let name = &cmd.name; - let path_name = if name.ends_with(std::path::MAIN_SEPARATOR) + let path_name = if name.ends_with(std::path::is_separator) || (cmd.args.is_empty() && PathBuf::from(name).is_dir() && dunce::canonicalize(name).is_ok()