Skip to content

Commit 4ca7e74

Browse files
committed
Improve melter error message
1 parent fbc0fe4 commit 4ca7e74

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pdxu-app/src/main/java/com/crschnick/pdxu/app/util/integration/RakalyHelper.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.crschnick.pdxu.app.savegame.SavegameContext;
55

66
import java.io.IOException;
7+
import java.nio.file.Files;
78
import java.nio.file.Path;
89

910
public class RakalyHelper {
@@ -15,6 +16,7 @@ public static boolean shouldShowButton(SavegameContext<?, ?> context) {
1516

1617
public static byte[] toMeltedPlaintext(Path file) throws Exception {
1718
var melter = PdxuInstallation.getInstance().getRakalyExecutable();
19+
check(melter);
1820
var proc = new ProcessBuilder(
1921
melter.toString(),
2022
"melt",
@@ -35,8 +37,10 @@ public static byte[] toMeltedPlaintext(Path file) throws Exception {
3537
}
3638

3739
public static byte[] toEquivalentPlaintext(Path file) throws Exception {
40+
var melter = PdxuInstallation.getInstance().getRakalyExecutable();
41+
check(melter);
3842
var proc = new ProcessBuilder(
39-
PdxuInstallation.getInstance().getRakalyExecutable().toString(),
43+
melter.toString(),
4044
"melt",
4145
"--unknown-key", "stringify",
4246
"--retain",
@@ -54,4 +58,10 @@ public static byte[] toEquivalentPlaintext(Path file) throws Exception {
5458

5559
return b;
5660
}
61+
62+
private static void check(Path file) throws IOException {
63+
if (!Files.exists(file)) {
64+
throw new IOException("Ironman melter executable " + file + " is missing. This is usually caused by Windows Defender or another AntiVirus program removing the melter executable because it thinks it's malicious.\n\nYou can try deleting %LOCALAPPDATA%\\Programs\\Pdx-Unlimiter\\app\\ and relaunching pdxu. That should trigger a new download. If the file then gets removed again, you probably have to add an exception to your antivirus.");
65+
}
66+
}
5767
}

0 commit comments

Comments
 (0)