mirror of
https://github.com/uutils/coreutils
synced 2024-09-06 16:03:44 +00:00
Merge pull request #3103 from water-ghosts/fs-nonexistent-directory
Don't panic when canonicalizing a nonexistent path
This commit is contained in:
commit
338ab17c40
|
@ -299,9 +299,8 @@ pub fn canonicalize<P: AsRef<Path>>(
|
|||
let original = if original.is_absolute() {
|
||||
original.to_path_buf()
|
||||
} else {
|
||||
dunce::canonicalize(env::current_dir().unwrap())
|
||||
.unwrap()
|
||||
.join(original)
|
||||
let current_dir = env::current_dir()?;
|
||||
dunce::canonicalize(current_dir)?.join(original)
|
||||
};
|
||||
|
||||
let mut result = PathBuf::new();
|
||||
|
|
Loading…
Reference in a new issue