Enhance syncback functionality and improve code readability

- Refactored the syncback process to streamline directory management and improve handling of class transitions in clean mode.
- Updated the `clone_tree_filtered` function to accept a tuple of compiled Globs and original pattern strings, enhancing flexibility in ignore pattern handling.
- Simplified logic for checking if paths are inside removed directories, improving code clarity.
- Added detailed comments to clarify the purpose of new logic for handling script directory transitions, ensuring better maintainability.
- Improved logging for better traceability during syncback operations.
This commit is contained in:
Joe 2026-02-01 20:10:11 -06:00
parent 1534a54808
commit 411f79ee81
10 changed files with 232 additions and 65 deletions

View file

@ -53,10 +53,7 @@ pub fn run_rojo_build(project_path: &Path, output_name: &str) -> (TempDir, PathB
pub fn run_rojo_syncback_clean(project_path: &Path, input_path: &Path) -> bool {
// Verify input file exists before calling
if !input_path.exists() {
eprintln!(
"ERROR: Input file does not exist: {}",
input_path.display()
);
eprintln!("ERROR: Input file does not exist: {}", input_path.display());
return false;
}
@ -319,7 +316,10 @@ pub fn apply_mutation(dir: &Path, mutation: &Mutation) {
fs::remove_dir_all(&path).expect("Failed to delete directory");
}
}
Mutation::ConvertDirToFile { dir: dir_path, file_content } => {
Mutation::ConvertDirToFile {
dir: dir_path,
file_content,
} => {
let path = dir.join(dir_path);
if path.exists() && path.is_dir() {
fs::remove_dir_all(&path).expect("Failed to remove directory");