try writing the crash info to file as well on mac, becase notification center cuts the whole message

This commit is contained in:
Anton Keks 2022-01-12 20:00:15 +02:00
parent ff5bf7f738
commit 04d65a45f5

View File

@ -12,6 +12,8 @@ import net.azib.ipscan.gui.InfoDialog;
import net.azib.ipscan.gui.MacApplicationMenu;
import net.azib.ipscan.util.GoogleAnalytics;
import java.io.File;
import java.nio.file.Files;
import java.security.Security;
import java.util.Locale;
import java.util.logging.Logger;
@ -88,6 +90,8 @@ public class Main {
private static void showFallbackError(String message) {
try {
System.err.println(message);
try { Files.writeString(File.createTempFile("ipscan-crash-", ".txt").toPath(), message); } catch (Exception ignore) {}
if (Platform.MAC_OS)
Runtime.getRuntime().exec(new String[] {"osascript", "-e", "display notification \"" + message + "\" with title \"Angry IP Scanner\""});
else
@ -96,7 +100,6 @@ public class Main {
}
catch (Exception e) {
System.err.println(e);
System.err.println(message);
}
}