summaryrefslogtreecommitdiffstats
path: root/src/io
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2021-10-31 19:07:25 -0400
committerJeff Zhao <jeff.no.zhao@gmail.com>2021-10-31 19:07:40 -0400
commit5b62956b45c9619240251f686132871ca4ce4a13 (patch)
tree17c0f64af8f2791db676a406c2f9428bd8946fb9 /src/io
parent28a798aa09de5bef46e0a323e95df3abb017d37e (diff)
fix paste overwrite erroring when creating directories
Diffstat (limited to 'src/io')
-rw-r--r--src/io/io_worker.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/io/io_worker.rs b/src/io/io_worker.rs
index e5a62f1..d11687f 100644
--- a/src/io/io_worker.rs
+++ b/src/io/io_worker.rs
@@ -198,7 +198,12 @@ pub fn recursive_copy(
}
let file_type = fs::symlink_metadata(src)?.file_type();
if file_type.is_dir() {
- fs::create_dir(dest_buf.as_path())?;
+ match fs::create_dir(dest_buf.as_path()) {
+ Ok(_) => {},
+ e => if !options.overwrite {
+ return e;
+ },
+ }
for entry in fs::read_dir(src)? {
let entry = entry?;
let entry_path = entry.path();