From 95549473bd659d32d5ac18bdd6f66970f55ea354 Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 24 Aug 2025 23:35:44 +0800 Subject: [PATCH] fix(tauri): ensure ~/.claude directory exists before copying provider settings into main settings file --- src-tauri/src/provider.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/provider.rs b/src-tauri/src/provider.rs index a0a2119..9e2127f 100644 --- a/src-tauri/src/provider.rs +++ b/src-tauri/src/provider.rs @@ -154,6 +154,12 @@ impl ProviderManager { } } + // 确保主配置父目录存在 + if let Some(parent) = settings_path.parent() { + std::fs::create_dir_all(parent) + .map_err(|e| format!("创建目录失败: {}", e))?; + } + // 复制新供应商配置到主配置 copy_file(&provider_config_path, &settings_path)?; @@ -177,4 +183,4 @@ impl ProviderManager { pub fn get_all_providers(&self) -> &HashMap { &self.providers } -} \ No newline at end of file +}