Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: exclude entry before type branching

Vanalite74d868ce8257
diff --git a/src-tauri/src/core/app/helpers.rs b/src-tauri/src/core/app/helpers.rs
index 6715e73cb..fa8bebf90 100644
--- a/src-tauri/src/core/app/helpers.rs
+++ b/src-tauri/src/core/app/helpers.rs
@@ -16,16 +16,21 @@ pub fn copy_dir_recursive(
let src_path = entry.path();
let dst_path = dst.join(entry.file_name());
- if file_type.is_dir() {
- // Skip excluded directories
- if let Some(dir_name) = entry.file_name().to_str() {
- if exclude_dirs.contains(&dir_name) {
- continue;
- }
+ if let Some(name) = entry.file_name().to_str() {
+ if exclude_dirs.contains(&name) {
+ continue;
}
+ }
+
+ let is_dir = file_type.is_dir()
+ || (file_type.is_symlink() && src_path.is_dir());
+
+ if is_dir {
copy_dir_recursive(&src_path, &dst_path, exclude_dirs)?;
- } else {
+ } else if file_type.is_file() || file_type.is_symlink() {
fs::copy(&src_path, &dst_path)?;
+ } else {
+ log::debug!("Skipping non-regular file: {src_path:?}");
}
}