diff --git a/src/confirmation.rs b/src/confirmation.rs index c9eb6f7..07887d7 100644 --- a/src/confirmation.rs +++ b/src/confirmation.rs @@ -3,7 +3,7 @@ use crate::logger; use crate::delete; use crate::utils; -pub fn show_confirmation(ctx: &egui::Context, message: &str, status: &Option, confirm_delete: &mut Option<(String, bool)>) -> Option { +pub fn show_confirmation(ctx: &egui::Context, message: &str, status: &Option) -> Option { let mut result = None; egui::Window::new("确认操作") @@ -20,8 +20,7 @@ pub fn show_confirmation(ctx: &egui::Context, message: &str, status: &Option, ) { - if let Some((folder_name, _)) = confirm_delete { + if let Some((folder_name, _)) = confirm_delete.clone() { let message = format!("确定要彻底删除文件夹 {} 吗?", folder_name); logger::log_info(&message); - if let Some(confirm) = show_confirmation(ctx, &message, status, confirm_delete) { + if let Some(confirm) = show_confirmation(ctx, &message, status) { if confirm { if let Some(base_path) = utils::get_appdata_dir(selected_appdata_folder) { let full_path = base_path.join(&folder_name); @@ -74,6 +73,8 @@ pub fn handle_delete_confirmation( )); *status = Some(format!("无法获取 {} 文件夹路径", selected_appdata_folder)); } + } else { + *confirm_delete = None; // 用户选择关闭或取消 } } }