From f9f35c94765ee73f0d54f61e3767d13f96f7ac78 Mon Sep 17 00:00:00 2001 From: teernisse Date: Thu, 26 Feb 2026 09:56:24 -0500 Subject: [PATCH] chore: call tmp file cleanup on app startup Integrates the bridge's cleanup_tmp_files() method into the Tauri setup phase. This ensures any orphaned .json.tmp files from previous crashes are cleaned up before the app starts operating. The cleanup runs early in setup(), before tray and shortcuts, to ensure a clean state for the bridge to operate in. Co-Authored-By: Claude Opus 4.5 --- src-tauri/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 4cd5e12..544504d 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -126,6 +126,19 @@ pub fn run() { .build(), ) .setup(|app| { + // Clean up orphaned tmp files from previous crashes + { + use data::beads::RealBeadsCli; + use data::bridge::Bridge; + use data::lore::RealLoreCli; + + let bridge: Bridge = + Bridge::new(RealLoreCli, RealBeadsCli); + if let Err(e) = bridge.cleanup_tmp_files() { + tracing::warn!("Failed to clean up tmp files: {}", e); + } + } + // Set up system tray if let Err(e) = setup_tray(app) { tracing::error!("Failed to setup system tray: {}", e);