summaryrefslogtreecommitdiff
path: root/ext/fs/std_fs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fs/std_fs.rs')
-rw-r--r--ext/fs/std_fs.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/fs/std_fs.rs b/ext/fs/std_fs.rs
index 1176697de..6bc15a72d 100644
--- a/ext/fs/std_fs.rs
+++ b/ext/fs/std_fs.rs
@@ -576,6 +576,12 @@ fn cp(from: &Path, to: &Path) -> FsResult<()> {
);
}
}
+
+ // Ensure parent destination directory exists
+ if let Some(parent) = to.parent() {
+ fs::create_dir_all(parent)?;
+ }
+
copy_file(from, to)
}