diff --git a/src/utils/fs.rs b/src/utils/fs.rs index 4752e63..f5a23fc 100644 --- a/src/utils/fs.rs +++ b/src/utils/fs.rs @@ -212,6 +212,12 @@ pub fn try_infer_extension(path: &Path) -> Option { /// Copy the src directory into the dst directory recursively 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)? { let entry = entry?; let ty = entry.file_type()?;