From 7069fb2abee3f488a947853152d7830c53c650f0 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Thu, 1 Oct 2026 16:24:21 -0700 Subject: [PATCH] fix: Uninstall removes an update staged beside the binary Uninstall deleted ~/.local/bin/snowbound but left the .snowbound.update folder an update check had downloaded next to it. Assisted-by: claude-opus-5.5 --- crates/snowbound/src/desktop_linux.rs | 6 ++++++ crates/snowbound/src/update.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/snowbound/src/desktop_linux.rs b/crates/snowbound/src/desktop_linux.rs index bbc454b432386d5d7b9278beb33d1364588e6a3b..463e86fbdf2dd3f6084d7df8a9264083ae101159 100644 --- a/crates/snowbound/src/desktop_linux.rs +++ b/crates/snowbound/src/desktop_linux.rs @@ -412,6 +412,12 @@ pub fn uninstall() { } let mut failed = None; let icons = SIZES.map(|side| theme_icon(&data, side)); + if let Some(staged) = crate::update::staging(&binary) + && let Err(error) = fs::remove_dir_all(staged) + && error.kind() != io::ErrorKind::NotFound + { + failed.get_or_insert(error); + } for path in [entry(&data), mime_types(&data), binary] .iter() .chain(&icons) diff --git a/crates/snowbound/src/update.rs b/crates/snowbound/src/update.rs index 089d41887f0fe6e07b7b52e981760ceb303bfc20..cc0ffd2f091a9e1bcb3964ffb31e289aa4817032 100644 --- a/crates/snowbound/src/update.rs +++ b/crates/snowbound/src/update.rs @@ -294,7 +294,7 @@ fn install() -> Option { } /// The folder an update to `install` unpacks into, beside it so the swap is a rename. -fn staging(install: &Path) -> Option { +pub fn staging(install: &Path) -> Option { let name = install.file_name()?.to_string_lossy(); Some(install.with_file_name(format!(".{name}.update"))) } -- 2.54.0