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 <noreply@anthropic.com>
This commit is contained in:
teernisse
2026-02-26 09:56:24 -05:00
parent 5059eb008a
commit f9f35c9476

View File

@@ -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<RealLoreCli, RealBeadsCli> =
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);