mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Correct behavior of cp -r with non-existent dest
This commit is contained in:
parent
c827795d17
commit
13d97ee1cc
1 changed files with 6 additions and 1 deletions
|
@ -726,7 +726,12 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult
|
|||
}
|
||||
|
||||
let root_path = Path::new(&root).canonicalize()?;
|
||||
let root_parent = root_path.parent();
|
||||
|
||||
let root_parent = if target.exists() {
|
||||
root_path.parent()
|
||||
} else {
|
||||
Some(root_path.as_path())
|
||||
};
|
||||
|
||||
for path in WalkDir::new(root) {
|
||||
let path = or_continue!(or_continue!(path).path().canonicalize());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue