From 22bf3b0e7659262d157903600f5cb42e41bc512f Mon Sep 17 00:00:00 2001 From: Vhati Date: Sat, 7 Sep 2013 01:29:39 -0400 Subject: [PATCH] Made the 'patching complete' dialog stay open, when the game cannot or should not be run --- .../net/vhati/modmanager/ui/ManagerFrame.java | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/vhati/modmanager/ui/ManagerFrame.java b/src/main/java/net/vhati/modmanager/ui/ManagerFrame.java index 75f04fe..8bce8cf 100644 --- a/src/main/java/net/vhati/modmanager/ui/ManagerFrame.java +++ b/src/main/java/net/vhati/modmanager/ui/ManagerFrame.java @@ -773,7 +773,14 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver resDat.bakFile = new File( backupDir, "resource.dat.bak" ); ModPatchDialog patchDlg = new ModPatchDialog( this, true ); - patchDlg.setSuccessTask( new SpawnGameTask() ); + + String neverRunFtl = appConfig.getProperty( "never_run_ftl", "false" ); + if ( !neverRunFtl.equals("true") ) { + File exeFile = FTLUtilities.findGameExe( datsDir ); + if ( exeFile != null ) { + patchDlg.setSuccessTask( new SpawnGameTask( exeFile ) ); + } + } log.info( "" ); log.info( "Patching..." ); @@ -917,24 +924,24 @@ public class ManagerFrame extends JFrame implements ActionListener, HashObserver private class SpawnGameTask implements Runnable { + private final File exeFile; + + public SpawnGameTask( File exeFile ) { + this.exeFile = exeFile; + } + @Override public void run() { - String neverRunFtl = appConfig.getProperty( "never_run_ftl", "false" ); - if ( !neverRunFtl.equals("true") ) { - File datsDir = new File( appConfig.getProperty( "ftl_dats_path" ) ); - - File exeFile = FTLUtilities.findGameExe( datsDir ); - if ( exeFile != null ) { - int response = JOptionPane.showConfirmDialog( ManagerFrame.this, "Do you want to run the game now?", "Ready to Play", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); - if ( response == JOptionPane.YES_OPTION ) { - log.info( "Running FTL..." ); - try { - FTLUtilities.launchGame( exeFile ); - } catch ( Exception e ) { - log.error( "Error launching FTL.", e ); - } - exitApp(); + if ( exeFile != null ) { + int response = JOptionPane.showConfirmDialog( ManagerFrame.this, "Do you want to run the game now?", "Ready to Play", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); + if ( response == JOptionPane.YES_OPTION ) { + log.info( "Running FTL..." ); + try { + FTLUtilities.launchGame( exeFile ); + } catch ( Exception e ) { + log.error( "Error launching FTL.", e ); } + exitApp(); } } }