mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
Fix 'enter' to expand path before checking for it (#4370)
This commit is contained in:
parent
565be6aaef
commit
19caef260d
1 changed files with 4 additions and 3 deletions
|
@ -37,6 +37,10 @@ impl Command for Enter {
|
||||||
let path_span = new_path.span()?;
|
let path_span = new_path.span()?;
|
||||||
|
|
||||||
let new_path = new_path.as_path()?;
|
let new_path = new_path.as_path()?;
|
||||||
|
|
||||||
|
let cwd = current_dir(engine_state, stack)?;
|
||||||
|
let new_path = nu_path::canonicalize_with(new_path, &cwd)?;
|
||||||
|
|
||||||
if !new_path.exists() {
|
if !new_path.exists() {
|
||||||
return Err(ShellError::DirectoryNotFound(path_span));
|
return Err(ShellError::DirectoryNotFound(path_span));
|
||||||
}
|
}
|
||||||
|
@ -48,9 +52,6 @@ impl Command for Enter {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let cwd = current_dir(engine_state, stack)?;
|
|
||||||
let new_path = nu_path::canonicalize_with(new_path, &cwd)?;
|
|
||||||
|
|
||||||
let new_path = Value::String {
|
let new_path = Value::String {
|
||||||
val: new_path.to_string_lossy().to_string(),
|
val: new_path.to_string_lossy().to_string(),
|
||||||
span: call.head,
|
span: call.head,
|
||||||
|
|
Loading…
Reference in a new issue