diff options
| author | Adam <[email protected]> | 2025-12-21 04:35:09 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-12-21 04:36:02 -0600 |
| commit | 5072331f0444f0ce67a8266b6687144171582c08 (patch) | |
| tree | 504e82015e1f8e9eb412ac86eac903a306e18981 /packages | |
| parent | 9d48fd4bbdd74770bf4d8a59a476b1bbc0b9d817 (diff) | |
| download | opencode-5072331f0444f0ce67a8266b6687144171582c08.tar.gz opencode-5072331f0444f0ce67a8266b6687144171582c08.zip | |
fix(desktop): incorrect state dir on macos
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/tauri/src-tauri/src/lib.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/tauri/src-tauri/src/lib.rs b/packages/tauri/src-tauri/src/lib.rs index ffefbabf6..3c08841ab 100644 --- a/packages/tauri/src-tauri/src/lib.rs +++ b/packages/tauri/src-tauri/src/lib.rs @@ -6,7 +6,7 @@ use std::{ sync::{Arc, Mutex}, time::{Duration, Instant}, }; -use tauri::{AppHandle, LogicalSize, Manager, RunEvent, WebviewUrl, WebviewWindow}; +use tauri::{AppHandle, LogicalSize, Manager, RunEvent, WebviewUrl, WebviewWindow, path::BaseDirectory}; use tauri_plugin_clipboard_manager::ClipboardExt; use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogResult}; use tauri_plugin_shell::process::{CommandChild, CommandEvent}; @@ -97,6 +97,11 @@ fn spawn_sidecar(app: &AppHandle, port: u32) -> CommandChild { let log_state = app.state::<LogState>(); let log_state_clone = log_state.inner().clone(); + let state_dir = app + .path() + .resolve("", BaseDirectory::AppLocalData) + .expect("Failed to resolve app local data dir"); + #[cfg(target_os = "windows")] let (mut rx, child) = app .shell() @@ -104,6 +109,7 @@ fn spawn_sidecar(app: &AppHandle, port: u32) -> CommandChild { .unwrap() .env("OPENCODE_EXPERIMENTAL_ICON_DISCOVERY", "true") .env("OPENCODE_CLIENT", "desktop") + .env("XDG_STATE_HOME", &state_dir) .args(["serve", &format!("--port={port}")]) .spawn() .expect("Failed to spawn opencode"); @@ -120,6 +126,7 @@ fn spawn_sidecar(app: &AppHandle, port: u32) -> CommandChild { .command(&shell) .env("OPENCODE_EXPERIMENTAL_ICON_DISCOVERY", "true") .env("OPENCODE_CLIENT", "desktop") + .env("XDG_STATE_HOME", &state_dir) .args([ "-il", "-c", |
