将 config 写入改为原子写入,防止潜在的异常中断导致配置文件失效问题

This commit is contained in:
HerobrineXia committed 2026-08-28 16:45:43 +08:00
1 parent 3f4bc4df2e
commit 6b292a45f7
3 files changed
+41 -1

No files matched your search

+1 -1
View File
@@ -112,7 +112,7 @@ public class JsonConfigProvider : IConfigProvider {
public void Save() {
if (!isDirty) return;
isDirty = false;
lock (this) FileUtils.Write(filePath, json.Value.ToString(Formatting.Indented));
lock (this) FileUtils.WriteAtomic(filePath, json.Value.ToString(Formatting.Indented));
}
}