diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-11-13 09:44:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 09:44:01 -0500 |
commit | 6e1f3aa0131f145db631d5dfb94c2b9404172194 (patch) | |
tree | 2d48695f5efb15312e7e78c1fa0d2addfd0a03f5 /cli/util/fs.rs | |
parent | 542314a0becbba120dbee13b3f410f647b4c9cb7 (diff) |
fix(install): should work with non-existent relative root (#21161)
Closes #21160
Diffstat (limited to 'cli/util/fs.rs')
-rw-r--r-- | cli/util/fs.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cli/util/fs.rs b/cli/util/fs.rs index c1fd00f5e..33eb3af9d 100644 --- a/cli/util/fs.rs +++ b/cli/util/fs.rs @@ -206,8 +206,14 @@ pub fn canonicalize_path_maybe_not_exists_with_fs( return Ok(canonicalized_path); } Err(err) if err.kind() == ErrorKind::NotFound => { - names_stack.push(path.file_name().unwrap()); - path = path.parent().unwrap(); + names_stack.push(match path.file_name() { + Some(name) => name.to_owned(), + None => return Err(err), + }); + path = match path.parent() { + Some(parent) => parent, + None => return Err(err), + }; } Err(err) => return Err(err), } |