Fix bugs across all crates

This commit is contained in:
2026-03-07 23:35:32 +02:00
parent 72c519bebc
commit 96f6973d39
8 changed files with 77 additions and 30 deletions

View File

@@ -120,6 +120,11 @@ impl ConvertConfig {
}
}
}
/// Returns true if this conversion will change at least some file extensions.
pub fn changes_extension(&self) -> bool {
!matches!(self, Self::KeepOriginal)
}
}
// --- Compress ---
@@ -318,6 +323,18 @@ pub struct RenameConfig {
fn default_counter_position() -> u32 { 3 }
impl RenameConfig {
/// Returns true if this rename config would actually change any filename.
pub fn changes_filename(&self) -> bool {
!self.prefix.is_empty()
|| !self.suffix.is_empty()
|| self.counter_enabled
|| !self.regex_find.is_empty()
|| self.case_mode > 0
|| self.replace_spaces > 0
|| self.special_chars > 0
|| self.template.is_some()
}
/// Pre-compile the regex for batch use. Call once before a loop of apply_simple_compiled.
pub fn compile_regex(&self) -> Option<regex::Regex> {
rename::compile_rename_regex(&self.regex_find)