Skip to content

Commit c9ce6b4

Browse files
committed
备份的时候复制而不是移动文件
fix #23
1 parent e7f9f5b commit c9ce6b4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

MaiChartManager/Controllers/ModController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ public void SetAquaMaiConfig(AquaMaiConfigDto.ConfigSaveDto config)
250250
if (System.IO.File.Exists(AquaMaiConfigPath))
251251
{
252252
Directory.CreateDirectory(AquaMaiConfigBackupDirPath);
253-
System.IO.File.Move(AquaMaiConfigPath, Path.Combine(AquaMaiConfigBackupDirPath, $"{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.toml"));
253+
var backupPath = Path.Combine(AquaMaiConfigBackupDirPath, $"{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.toml");
254+
var originalContent = System.IO.File.ReadAllBytes(AquaMaiConfigPath);
255+
System.IO.File.WriteAllBytes(backupPath, originalContent);
254256
}
255257

256258
System.IO.File.WriteAllText(Path.Combine(StaticSettings.GamePath, "AquaMai.toml"), serializer.Serialize(configEdit));

0 commit comments

Comments
 (0)