Cleaned up some dodgy code when initially prompting for FTL's location

This commit is contained in:
Vhati 2013-09-20 06:24:52 -04:00
parent 5970fbcc66
commit 3646de2aec
3 changed files with 29 additions and 17 deletions

View file

@ -25,7 +25,7 @@ public class FTLModManager {
private static final Logger log = LogManager.getLogger(FTLModManager.class);
public static final String APP_NAME = "Slipstream Mod Manager";
public static final ComparableVersion APP_VERSION = new ComparableVersion( "1.3" );
public static final ComparableVersion APP_VERSION = new ComparableVersion( "1.4" );
public static final String APP_URL = "http://www.ftlgame.com/forum/viewtopic.php?f=12&t=17102";
public static final String APP_AUTHOR = "Vhati";
@ -33,6 +33,20 @@ public class FTLModManager {
public static void main( String[] args ) {
if ( args.length > 0 ) SlipstreamCLI.main( args );
// Ensure all popups are triggered from the event dispatch thread.
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
guiInit();
}
});
}
private static void guiInit() {
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") ) );
@ -156,7 +170,7 @@ public class FTLModManager {
}
final SlipstreamConfig appConfig = new SlipstreamConfig( config, configFile );
SlipstreamConfig appConfig = new SlipstreamConfig( config, configFile );
if ( writeConfig ) {
try {
appConfig.writeConfig();
@ -168,20 +182,15 @@ public class FTLModManager {
}
}
// Create the GUI.
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
ManagerFrame frame = new ManagerFrame( appConfig, APP_NAME, APP_VERSION, APP_URL, APP_AUTHOR );
frame.init();
frame.setVisible(true);
} catch ( Exception e ) {
log.error( "Exception while creating ManagerFrame.", e );
System.exit(1);
}
}
});
// Create the main window.
try {
ManagerFrame frame = new ManagerFrame( appConfig, APP_NAME, APP_VERSION, APP_URL, APP_AUTHOR );
frame.init();
frame.setVisible(true);
} catch ( Exception e ) {
log.error( "Exception while creating ManagerFrame.", e );
System.exit(1);
}
}