From f1a8a6e28a9407ba581ba0cad99434a8d877c9ce Mon Sep 17 00:00:00 2001 From: Starpoles Date: Thu, 29 Jan 2026 00:00:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=B0=86=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BF=9D=E5=AD=98=E5=88=B0=E7=A3=81=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index ae30fe6..52dccf4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -124,11 +124,12 @@ is_decompose = {is_decompose} } pub fn save_with_comments(&self, path: impl AsRef) -> io::Result<()> { - let path = path.as_ref(); + /*let path = path.as_ref(); if let Some(parent) = path.parent() { fs::create_dir_all(parent)?; } - fs::write(path, self.to_toml_with_comments()) + fs::write(path, self.to_toml_with_comments())*/ + Ok(()) } /// 读取配置:不存在则创建(写入默认值+注释),存在则从文件构造实例。 @@ -136,7 +137,7 @@ is_decompose = {is_decompose} /// - toml 缺字段:会自动用 Default 补齐(因为 #[serde(default)]) /// - 可选:如果你想“读取后把缺的字段补齐回写”,这里也做了回写 pub fn load_or_create(path: impl AsRef) -> Result> { - let path = path.as_ref(); + /*let path = path.as_ref(); if !path.exists() { let cfg = Self::default(); @@ -149,7 +150,15 @@ is_decompose = {is_decompose} // 可选:自动回写补全(比如用户旧版配置少字段时,补齐并带注释写回去) // 如果你不想覆盖用户文件,把下面两行删掉即可。 - cfg.save_with_comments(path)?; + cfg.save_with_comments(path)?;*/ + let cfg = Config { + is_daily_missions: true, + is_archipelago: true, + is_spiral_abyss: false, + is_demonic_energy: true, + is_forest: true, + is_decompose: true, + }; Ok(cfg) }