Refactor file renaming logic in JobThreadContext and improve path handling

- Simplified the logic for resolving the actual file to rename, consolidating the handling of directory and file paths.
- Enhanced the script renaming process to ensure correct naming conventions based on class type, improving clarity and consistency.
- Updated logging to provide better insights during class name changes and file renaming operations, aiding in debugging.
- Made minor formatting adjustments to improve code readability in the `suppressed_paths` method and API service file handling.
This commit is contained in:
Joe 2026-02-05 18:52:10 -06:00
parent f38c96e12b
commit e6944e3132
3 changed files with 62 additions and 60 deletions

View file

@ -180,7 +180,9 @@ impl ApiService {
} else if let Some(parent) = path.parent() {
if let Ok(canonical_parent) = std::fs::canonicalize(parent) {
if let Some(file_name) = path.file_name() {
*suppressed.entry(canonical_parent.join(file_name)).or_insert(0) += 1;
*suppressed
.entry(canonical_parent.join(file_name))
.or_insert(0) += 1;
}
}
}
@ -1545,8 +1547,7 @@ impl ApiService {
if !has_children && !has_metadata {
let gitkeep = dir_path.join(".gitkeep");
self.suppress_path(&gitkeep);
fs::write(gitkeep, b"")
.with_context(|| "Failed to write .gitkeep")?;
fs::write(gitkeep, b"").with_context(|| "Failed to write .gitkeep")?;
}
log::info!(