From 9e8501942f953ff840ec9ca77c7d2ea0c9d0bd13 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Sun, 7 Dec 2025 19:50:42 +0200 Subject: [PATCH] Refactor opencode binary resolution to use login shell for full PATH and enhance dmg configuration in tauri.conf.json --- .../desktop/src-tauri/src/opencode_manager.rs | 19 ++++++++----------- packages/desktop/src-tauri/tauri.conf.json | 7 ++++++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/desktop/src-tauri/src/opencode_manager.rs b/packages/desktop/src-tauri/src/opencode_manager.rs index 4f8f2240..b5759d1a 100644 --- a/packages/desktop/src-tauri/src/opencode_manager.rs +++ b/packages/desktop/src-tauri/src/opencode_manager.rs @@ -513,21 +513,18 @@ fn resolve_opencode_binary() -> Option { } } - // Find in PATH - if let Ok(output) = std::process::Command::new("which") - .arg("opencode") - .output() - { - if output.status.success() { - let path = String::from_utf8_lossy(&output.stdout).trim().to_string(); - if !path.is_empty() { - info!("[desktop:opencode] found binary in PATH: {}", path); - return Some(path); + // Use login shell to get full PATH (app bundles have limited PATH) + if let Ok(login_path) = detect_login_shell_path() { + for dir in login_path.split(':') { + let candidate = format!("{}/opencode", dir); + if Path::new(&candidate).exists() { + info!("[desktop:opencode] found binary in PATH: {}", candidate); + return Some(candidate); } } } - warn!("[desktop:opencode] opencode binary not found in PATH"); + warn!("[desktop:opencode] opencode binary not found"); None } diff --git a/packages/desktop/src-tauri/tauri.conf.json b/packages/desktop/src-tauri/tauri.conf.json index efaf61d6..66743e15 100644 --- a/packages/desktop/src-tauri/tauri.conf.json +++ b/packages/desktop/src-tauri/tauri.conf.json @@ -45,7 +45,12 @@ "exceptionDomain": "localhost", "minimumSystemVersion": "14.0", "signingIdentity": null, - "infoPlist": "Info.plist" + "infoPlist": "Info.plist", + "dmg": { + "appPosition": { "x": 180, "y": 170 }, + "applicationFolderPosition": { "x": 480, "y": 170 }, + "windowSize": { "width": 660, "height": 400 } + } }, "createUpdaterArtifacts": true },