mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Small fixes and refactors to paths & source command (#3998)
* Expand path when converting value -> PathBuf Also includes Tagged<PathBuf>. Fixes #3605 * Expand path for PATH env. variable Fixes #1834 * Remove leftover Cows after nu-path refactor There were some unnecessary Cow conversions leftover from the old nu-path implementation. * Use canonicalize in source command; Improve errors Previously, `source` used `expand_path()` which does not follow symlinks. As a follow up, I improved the source error messages so they now tell why the source file could not be canonicalized or read into string.
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
use std::borrow::Cow;
|
||||
use std::path::{is_separator, Path, PathBuf};
|
||||
|
||||
use super::matchers::Matcher;
|
||||
@ -27,7 +26,7 @@ impl PathCompleter {
|
||||
(base, rest)
|
||||
};
|
||||
|
||||
let base_dir = nu_path::expand_path(Cow::Borrowed(Path::new(&base_dir_name)));
|
||||
let base_dir = nu_path::expand_path(&base_dir_name);
|
||||
// This check is here as base_dir.read_dir() with base_dir == "" will open the current dir
|
||||
// which we don't want in this case (if we did, base_dir would already be ".")
|
||||
if base_dir == Path::new("") {
|
||||
|
Reference in New Issue
Block a user