-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive copy semantics are very unclear #24
Comments
Sorry, but fs_extra does not exist method dir_copy. fs_extra have this method fs_extra::dir::copy which contains third argument copy_options, where you can set necessary settings for copy operation. If you are expected this |
This is all not well explained in documentation. I was able to figure it out myself, but it require some trail and error. |
Thank you for your feedback, i will improve docs :) |
I have to agree that the semantics are are bit weird: Taking a look at the if options.copy_inside {
if to.exists() {
if let Some(dir_name) = from.components().last() {
to.push(dir_name.as_os_str());
} else {
err!("Invalid folder from", ErrorKind::InvalidFolder);
}
}
} else {
if let Some(dir_name) = from.components().last() {
to.push(dir_name.as_os_str());
} else {
err!("Invalid folder from", ErrorKind::InvalidFolder);
}
} Depending on the fact that the target directory exists or not, the outcome is different. And there seems to be no way to influence that. e.g.: copying
So the behavior of Which causes as problem when you want to copy from multiple source directories, to a single target directory with Also is the documentation of https://docs.rs/fs_extra/1.1.0/fs_extra/dir/fn.copy.html wrong IMHO. It refers to a non-existing copy option named I guess the right fix would be to simple drop the "if exists" check for |
Hi @ctron,
I checked right now behaviors
My bad... i missed this moment, when changed old name(mirror_copy) by new (copy_inside) |
is
goint to create
c/d/b
, or justc/d
? Does it depend onc/d
existing or not? The documentation is very unclear."Copies the directory contents from one place to another using recursive method. This function will also copy the permission bits of the original files to destionation files (not for directories)."
Explains non of it.
The text was updated successfully, but these errors were encountered: