mirror of
https://github.com/uutils/coreutils
synced 2024-11-16 09:48:03 +00:00
Fix panic when canonicalizing a nonexistent path
This commit is contained in:
parent
47b12b31a6
commit
6e0fedc277
1 changed files with 2 additions and 3 deletions
|
@ -299,9 +299,8 @@ pub fn canonicalize<P: AsRef<Path>>(
|
||||||
let original = if original.is_absolute() {
|
let original = if original.is_absolute() {
|
||||||
original.to_path_buf()
|
original.to_path_buf()
|
||||||
} else {
|
} else {
|
||||||
dunce::canonicalize(env::current_dir().unwrap())
|
let current_dir = env::current_dir()?;
|
||||||
.unwrap()
|
dunce::canonicalize(current_dir)?.join(original)
|
||||||
.join(original)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut result = PathBuf::new();
|
let mut result = PathBuf::new();
|
||||||
|
|
Loading…
Reference in a new issue