From 9d51a16a9a16a0caa25cc598ce27e24104d52d32 Mon Sep 17 00:00:00 2001 From: pobb <79351885+1506086927@users.noreply.github.com> Date: Thu, 14 May 2026 16:36:52 +0800 Subject: [PATCH] Update main.rs --- desktop/src-tauri/src/main.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/desktop/src-tauri/src/main.rs b/desktop/src-tauri/src/main.rs index 26593521..f249ebec 100644 --- a/desktop/src-tauri/src/main.rs +++ b/desktop/src-tauri/src/main.rs @@ -2,5 +2,16 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] fn main() { + // If CLAUDE_CONFIG_DIR is set (e.g. via portable launcher), also redirect + // WebView2 user data folder so EBWebView cache lives alongside it instead of + // under %LOCALAPPDATA%\com.claude-code-haha.desktop\. + if let Ok(config_dir) = std::env::var("CLAUDE_CONFIG_DIR") { + let webview_data = std::path::PathBuf::from(&config_dir).join("EBWebView"); + if let Err(e) = std::fs::create_dir_all(&webview_data) { + eprintln!("[desktop] failed to create EBWebView dir: {e}"); + } + std::env::set_var("WEBVIEW2_USER_DATA_FOLDER", &webview_data); + } + claude_code_desktop_lib::run() }