From aa0f191420fc4140c5bf328cf581c2051c8f0d4b Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 22 Jan 2026 17:09:45 +0800 Subject: [PATCH] fix(config): correct OpenCode config path on Windows OpenCode uses ~/.config/opencode on all platforms, not %APPDATA%\opencode on Windows. Remove the platform-specific path handling to use unified ~/.config/opencode path across all operating systems. --- src-tauri/src/opencode_config.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src-tauri/src/opencode_config.rs b/src-tauri/src/opencode_config.rs index df7b3529..d14daf9b 100644 --- a/src-tauri/src/opencode_config.rs +++ b/src-tauri/src/opencode_config.rs @@ -42,21 +42,10 @@ pub fn get_opencode_dir() -> PathBuf { return override_dir; } - #[cfg(target_os = "windows")] - { - // Windows: %APPDATA%\opencode - dirs::data_dir() - .map(|d| d.join("opencode")) - .unwrap_or_else(|| PathBuf::from(".config").join("opencode")) - } - - #[cfg(not(target_os = "windows"))] - { - // Unix: ~/.config/opencode - dirs::home_dir() - .map(|h| h.join(".config").join("opencode")) - .unwrap_or_else(|| PathBuf::from(".config").join("opencode")) - } + // 所有平台统一使用 ~/.config/opencode + dirs::home_dir() + .map(|h| h.join(".config").join("opencode")) + .unwrap_or_else(|| PathBuf::from(".config").join("opencode")) } /// 获取 OpenCode 配置文件路径