Update main.rs

This commit is contained in:
pobb 2026-05-14 16:36:52 +08:00 committed by GitHub
parent 40a76948ac
commit 9d51a16a9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()
}