Continuation of commit 4be63ee

This commit is contained in:
Vhati 2017-12-08 17:21:31 -05:00
parent 4be63eef06
commit 1603a7fc56

View file

@ -7,8 +7,10 @@ import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Properties;
import javax.swing.JOptionPane;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import net.vhati.modmanager.cli.SlipstreamCLI;
import net.vhati.modmanager.core.ComparableVersion;
@ -46,7 +48,7 @@ public class FTLModManager {
private static void guiInit() {
try {
log.debug( String.format( "%s v%s", APP_NAME, APP_VERSION ) );
log.debug( String.format( "%s %s", System.getProperty( "os.name" ), System.getProperty( "os.version" ) ) );
log.debug( String.format( "%s, %s, %s", System.getProperty( "java.vm.name" ), System.getProperty( "java.version" ), System.getProperty( "os.arch" ) ) );
@ -57,9 +59,7 @@ public class FTLModManager {
showErrorDialog( String.format( "Slipstream could not find its own folder.\nCurrently in: %s\n\nRun one of the following instead of the jar...\nWindows: modman.exe or modman_admin.exe\nLinux/OSX: modman.command or modman-cli.sh\n\nThe Mod Manager will now exit.", currentPath ) );
System.err.println( String.format( "Slipstream could not find its own folder (Currently in \"%s\"), exiting.", currentPath ) );
System.gc();
// System.exit( 1 ); // Don't do this (InterruptedException). Let EDT end gracefully.
return;
throw new ExitException();
}
@ -134,8 +134,7 @@ public class FTLModManager {
log.error( String.format( "Error writing config to \"%s\"", configFile.getPath(), g ) );
}
System.gc();
return;
throw new ExitException();
}
}
}
@ -183,9 +182,7 @@ public class FTLModManager {
showErrorDialog( "FTL resources were not found.\nThe Mod Manager will now exit." );
log.debug( "No FTL dats path found, exiting" );
System.gc();
// System.exit( 1 ); // Don't do this (InterruptedException). Let EDT end gracefully.
return;
throw new ExitException();
}
// Prompt if update_catalog is invalid or hasn't been set.
@ -237,14 +234,36 @@ public class FTLModManager {
catch ( Exception e ) {
log.error( "Exception while creating ManagerFrame", e );
throw new ExitException();
}
}
catch ( ExitException e ) {
System.gc();
// System.exit( 1 ); // Don't do this (InterruptedException). Let EDT end gracefully.
return;
}
}
private static void showErrorDialog( String message ) {
JOptionPane.showMessageDialog( null, message, "Error", JOptionPane.ERROR_MESSAGE );
}
private static class ExitException extends RuntimeException {
public ExitException() {
}
public ExitException( String message ) {
super( message );
}
public ExitException( Throwable cause ) {
super( cause );
}
public ExitException( String message, Throwable cause ) {
super( message, cause );
}
}
}