Skip to content

Commit

Permalink
Fix System.IO.IOException on save preprocessing (#414) #patch
Browse files Browse the repository at this point in the history
* Fix System.IO.IOException on save preprocessing

* const string
  • Loading branch information
IhateTrains authored Nov 21, 2021
1 parent f9f3376 commit d39c4ae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ImperatorToCK3/Helpers/RakalyCaller.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using commonItems;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;

namespace ImperatorToCK3.Helpers {
Expand All @@ -26,8 +27,13 @@ public static void MeltSave(string savePath) {
throw new FormatException($"Rakaly melter failed to melt {savePath} with exit code {returnCode}");
}

var meltedSavePath = CommonFunctions.TrimExtension(savePath) + "_melted.rome";
System.IO.File.Move(meltedSavePath, "temp/melted_save.rome");
var meltedSaveName = CommonFunctions.TrimExtension(savePath) + "_melted.rome";
const string destFileName = "temp/melted_save.rome";
//first, delete target file if exists, as File.Move() does not support overwrite
if (File.Exists(destFileName)) {
File.Delete(destFileName);
}
File.Move(meltedSaveName, destFileName);
}
}
}

0 comments on commit d39c4ae

Please sign in to comment.