add src and dst detection for utils copy_dir

Signed-off-by: tommady <tommady@users.noreply.github.com>
This commit is contained in:
tommady 2025-07-16 12:32:00 +00:00
parent 1f3257da70
commit a85c12a12f
No known key found for this signature in database
GPG Key ID: 175B664929DF2F2F

View File

@ -212,6 +212,12 @@ pub fn try_infer_extension(path: &Path) -> Option<Extension> {
/// Copy the src directory into the dst directory recursively /// Copy the src directory into the dst directory recursively
pub fn copy_dir(src: &Path, dst: &Path) -> crate::Result<()> { pub fn copy_dir(src: &Path, dst: &Path) -> crate::Result<()> {
if !src.exists() || !dst.exists() {
return Err(crate::Error::NotFound {
error_title: "source or destination directory does not exist".to_string(),
});
}
for entry in fs::read_dir(src)? { for entry in fs::read_dir(src)? {
let entry = entry?; let entry = entry?;
let ty = entry.file_type()?; let ty = entry.file_type()?;