Skip to content

Commit

Permalink
Better handle "Failed to create melted file" Rakaly error (#1989) #patch
Browse files Browse the repository at this point in the history
Sentry event ID: 8c7ab9ed5e204ef0a90421c059fc05c9
  • Loading branch information
IhateTrains authored Jun 13, 2024
1 parent d7ce765 commit 5c1aeaf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ImperatorToCK3/Helpers/RakalyCaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ public static void MeltSave(string savePath) {
if (stdErrText.Contains("There is not enough space on the disk.")) {
throw new UserErrorException($"{exceptionMessage} There is not enough space on the disk.");
}

if (stdErrText.Contains("Failed to create melted file")) {
// Try to copy the file to the converter's temp folder before melting.
var saveDisk = Path.GetPathRoot(savePath);
var converterDisk = Path.GetPathRoot(Directory.GetCurrentDirectory());

if (saveDisk != converterDisk) {
const string fallbackSavePath = "temp/save_to_be_melted.rome";
File.Copy(savePath, fallbackSavePath, overwrite: true);
MeltSave(fallbackSavePath);
return;
}
}

if (stdErrText.Contains("memory allocation of")) {
exceptionMessage += " One possible reason is that you don't have enough RAM.";
Expand Down

0 comments on commit 5c1aeaf

Please sign in to comment.