From 7ca5bcdc855456dcdf09aa0026038e24a0f12413 Mon Sep 17 00:00:00 2001 From: Ned Date: Thu, 1 Oct 2026 18:13:22 -0700 Subject: [PATCH] Fix platform-specific standalone Rust build warnings --- docs/specs/standalone.md | 4 +++- standalone/src-tauri/src/lib.rs | 4 ++-- standalone/src-tauri/src/quit_state.rs | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/specs/standalone.md b/docs/specs/standalone.md index c54888564..709cc8056 100644 --- a/docs/specs/standalone.md +++ b/docs/specs/standalone.md @@ -960,6 +960,8 @@ written. `session_temp_suffix_matches_what_the_writer_leaves`. Transcript migration follows `docs/specs/transport.md` → "Retiring the transcripts already on disk". +Source of truth: `write_file_with_permissions` in `standalone/src-tauri/src/lib.rs`. + **Must use `/dev` as the debug state root and `` for release builds** (rationale). `app_data_dir()` follows the Tauri identifier; `pnpm dev:standalone` already supplies a distinct per-worktree identifier @@ -1221,7 +1223,7 @@ with only the exit changed. then `tauri::process::restart`, which on macOS re-reads `Info.plist`, so a bundle replaced in place starts as the new version. **Never `AppHandle::request_restart`** (rationale). -- **A terminate the OS re-sends after approval clears the intent**, so logout +- **Must clear the restart intent when macOS re-sends an OS terminate after approval**, so logout never relaunches. - **`quit_restart` refuses a debug build and an executable `tauri::process::current_binary` cannot resolve**, where `restart` would exit diff --git a/standalone/src-tauri/src/lib.rs b/standalone/src-tauri/src/lib.rs index 3b799c9dd..8fda5925c 100644 --- a/standalone/src-tauri/src/lib.rs +++ b/standalone/src-tauri/src/lib.rs @@ -1839,7 +1839,7 @@ fn write_file_with_permissions( contents: &str, restrict: impl Fn(&Path, u32) -> Result<(), String>, ) -> Result<(), String> { - let dir = ensure_parent_with(path, &restrict)?; + let _dir = ensure_parent_with(path, &restrict)?; let tmp = temp_write_path(path); // Atomic replace: write a sibling temp file, fsync it, then rename over the // target so a crash mid-write can never truncate the previous good copy. @@ -1869,7 +1869,7 @@ fn write_file_with_permissions( // equivalent dir-fsync concept, so this is unix-only. #[cfg(unix)] { - if let Ok(d) = std::fs::File::open(dir) { + if let Ok(d) = std::fs::File::open(_dir) { let _ = d.sync_all(); } } diff --git a/standalone/src-tauri/src/quit_state.rs b/standalone/src-tauri/src/quit_state.rs index 62e43c222..d627d14ae 100644 --- a/standalone/src-tauri/src/quit_state.rs +++ b/standalone/src-tauri/src/quit_state.rs @@ -234,6 +234,7 @@ impl QuitMachine { /// The OS is ending the app itself (Dock Quit, logout), which never /// relaunches. + #[cfg(any(target_os = "macos", test))] pub fn forget_restart(&mut self) { self.intent = QuitIntent::default(); }