Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/specs/standalone.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<app_data_dir>/dev` as the debug state root and `<app_data_dir>` for
release builds** (rationale). `app_data_dir()` follows the Tauri identifier;
`pnpm dev:standalone` already supplies a distinct per-worktree identifier
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions standalone/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: _dir reads as unused, but it's still used on unix at the dir fsync below. Scoping the allow to non-unix keeps the name honest:

Suggested change
let _dir = ensure_parent_with(path, &restrict)?;
#[cfg_attr(not(unix), allow(unused_variables))]
let dir = ensure_parent_with(path, &restrict)?;

(and File::open(dir) at the fsync)

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.
Expand Down Expand Up @@ -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();
}
}
Expand Down
1 change: 1 addition & 0 deletions standalone/src-tauri/src/quit_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading