diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-10-31 19:07:25 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-10-31 19:07:40 -0400 |
commit | 5b62956b45c9619240251f686132871ca4ce4a13 (patch) | |
tree | 17c0f64af8f2791db676a406c2f9428bd8946fb9 /src/io | |
parent | 28a798aa09de5bef46e0a323e95df3abb017d37e (diff) |
fix paste overwrite erroring when creating directories
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/io_worker.rs | 7 |
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(); |