mirror of
https://github.com/nushell/nushell
synced 2025-01-12 21:29:07 +00:00
Fix set_pwd() return Result logic.
This commit is contained in:
parent
569929983c
commit
1057e648b0
1 changed files with 11 additions and 7 deletions
|
@ -81,14 +81,18 @@ pub mod windows {
|
|||
Ok(path_string) => {
|
||||
if let Some(drive) = extract_drive_letter(&path_string) {
|
||||
maintainer.maintain(env_var_for_drive(drive), value.clone());
|
||||
Ok(())
|
||||
} else if path_string.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
// Other path format, like UNC Network share path, or bash format
|
||||
// /c/Users/nushell will be supported later.
|
||||
Err(ShellError::InvalidValue {
|
||||
valid: format!("Can't detect drive letter from {}.", path_string),
|
||||
actual: path_string,
|
||||
span: Span::unknown(),
|
||||
})
|
||||
}
|
||||
// Other path format, like UNC Network share path, or bash format
|
||||
// /c/Users/nushell will be supported later.
|
||||
Err(ShellError::InvalidValue {
|
||||
valid: format!("Can't detect drive letter from {}.", path_string),
|
||||
actual: path_string,
|
||||
span: Span::unknown(),
|
||||
})
|
||||
}
|
||||
Err(e) => Err(ShellError::InvalidValue {
|
||||
valid: "$env.PWD should have String type and String::from_value() should be OK()."
|
||||
|
|
Loading…
Reference in a new issue