From a1471f2cf354bc739e47be065cbf14c66e3aefc5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 7 Nov 2026 18:34:39 -0800 Subject: [PATCH] craft-update: show_if alone decides whether Restart to Update closes the app restart_to_update only asks for the close; show_if returns Action::Close only while an update is ready, so the test of a call with no update ready fails when that check is removed. The test of a folder in place of an outcome record is removed: Windows refuses to open a folder, so it passed with the plain-file check removed. --- crates/update/src/updater.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/crates/update/src/updater.rs b/crates/update/src/updater.rs index a19209ed..c8019b10 100644 --- a/crates/update/src/updater.rs +++ b/crates/update/src/updater.rs @@ -296,11 +296,9 @@ impl Updater { /// Asks the app to close so that a ready update installs: the next [`Self::show_if`] that may /// close returns [`Action::Close`]. Restart to Update calls it after the user canceled an - /// earlier close. Does nothing when no update is ready. + /// earlier close. No close is asked for while no update is ready. pub fn restart_to_update(&mut self) { - if self.restart.is_some() { - self.close_wanted = true; - } + self.close_wanted = true; } /// Opens the startup prompt for a release the app found itself. @@ -1310,17 +1308,6 @@ mod tests { assert_eq!(u.prompt.as_ref().and_then(StartupPrompt::message), None, "the reason is shown once"); } - /// An unreadable record (a folder where the file goes) shows nothing and breaks nothing. - #[test] - fn an_unreadable_record_shows_nothing() { - let ctx = egui::Context::default(); - let (_dir, paths, mut u) = with_records("0.2.0"); - std::fs::create_dir_all(paths.logs().join("self-update-error.txt")).unwrap(); - std::fs::create_dir_all(paths.data.join("self-update-done.txt")).unwrap(); - start_answered(&mut u, &ctx, Ok(None)); - assert_eq!(u.status(), &Status::Idle); - } - /// The new version's first start says it was updated, once, and only when the finished /// update installed the version running now. #[test]