diff --git a/src/appstate.rs b/src/appstate.rs index ea58dff..67d44aa 100644 --- a/src/appstate.rs +++ b/src/appstate.rs @@ -2101,8 +2101,20 @@ impl AppState { let mut old_notes = new_project.notes.clone(); old_files.pop(); old_notes.pop(); - remove_dir_all(&old_files)?; - remove_dir_all(&old_notes)?; + remove_dir_all(&new_project.files)?; + remove_dir_all(&new_project.notes)?; + if let Err(_) = remove_dir(old_files) { + self.main_tx.send(ToolMessage::Output(( + rid, + String::from("organization files folder is not empty and will not be deleted."), + )))?; + } + if let Err(_) = remove_dir(old_notes) { + self.main_tx.send(ToolMessage::Output(( + rid, + String::from("organization notes folder is not empty and will not be deleted."), + )))?; + } new_files_path.push(&new_project.name); new_notes_path.push(&new_project.name); new_project.files(new_files_path.clone());