feat(config): migrate app_config_dir to Tauri Store for independent management (#109)

This commit is contained in:
ZyphrZero
2025-10-15 09:15:53 +08:00
committed by GitHub
parent 3e4df2c96a
commit 3b6048b1e8
14 changed files with 456 additions and 10 deletions

View File

@@ -64,7 +64,12 @@ impl Default for AppSettings {
impl AppSettings {
fn settings_path() -> PathBuf {
crate::config::get_app_config_dir().join("settings.json")
// settings.json 必须使用固定路径,不能被 app_config_dir 覆盖
// 否则会造成循环依赖:读取 settings 需要知道路径,但路径在 settings 中
dirs::home_dir()
.expect("无法获取用户主目录")
.join(".cc-switch")
.join("settings.json")
}
fn normalize_paths(&mut self) {
@@ -178,4 +183,4 @@ pub fn get_codex_override_dir() -> Option<PathBuf> {
.codex_config_dir
.as_ref()
.map(|p| resolve_override_path(p))
}
}