chore:
- add syncthing directories to be excluded in clean_target - rename FILES_TO_IGNORE to PATHS_TO_IGNORE
This commit is contained in:
parent
55a4da1bcc
commit
6c0ecb402c
@ -65,6 +65,15 @@ impl DirectoryProcessor {
|
|||||||
|
|
||||||
for entry in entries.flatten() {
|
for entry in entries.flatten() {
|
||||||
let path = entry.path();
|
let path = entry.path();
|
||||||
|
|
||||||
|
// Check if path should be ignored (both files and directories)
|
||||||
|
if let Some(name) = path.file_name().and_then(|n| n.to_str()) {
|
||||||
|
if FILES_TO_IGNORE.iter().any(|&ignore| name.contains(ignore)) {
|
||||||
|
is_empty = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
// Recursively check subdirectories
|
// Recursively check subdirectories
|
||||||
let subdir_empty = self.clean_target_directory(&path)?;
|
let subdir_empty = self.clean_target_directory(&path)?;
|
||||||
@ -87,14 +96,6 @@ impl DirectoryProcessor {
|
|||||||
format!("Error getting relative path for {}: {}", path.display(), e)
|
format!("Error getting relative path for {}: {}", path.display(), e)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Skip files that should be ignored
|
|
||||||
if let Some(file_name) = path.file_name().and_then(|n| n.to_str()) {
|
|
||||||
if FILES_TO_IGNORE.iter().any(|&ignore| file_name.ends_with(ignore)) {
|
|
||||||
is_empty = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if this file should exist based on source files
|
// Check if this file should exist based on source files
|
||||||
let should_exist = if let Some(ext) = rel_path.extension().and_then(|e| e.to_str()) {
|
let should_exist = if let Some(ext) = rel_path.extension().and_then(|e| e.to_str()) {
|
||||||
if ext == "pdf" {
|
if ext == "pdf" {
|
||||||
|
@ -10,7 +10,7 @@ pub const FILES_TO_COPY: [&str; 10] = [
|
|||||||
"jpg", "jpeg", "png", "gif", "bmp", "tiff", "webp", "avif", "txt", "md",
|
"jpg", "jpeg", "png", "gif", "bmp", "tiff", "webp", "avif", "txt", "md",
|
||||||
];
|
];
|
||||||
pub const FILES_TO_CONVERT: [&str; 3] = ["odt", "doc", "docx"];
|
pub const FILES_TO_CONVERT: [&str; 3] = ["odt", "doc", "docx"];
|
||||||
pub const FILES_TO_IGNORE: [&str; 1] = ["DS_Store"];
|
pub const FILES_TO_IGNORE: [&str; 5] = [".DS_Store", ".syncthing", ".sync-conflict-", ".stfolder", ".stversions"];
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(
|
#[command(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user