@@ -42,18 +42,18 @@ public LaunchGame(String cookie, String gameServer) {
4242 public void run () {
4343 ProcessBuilder pb = new ProcessBuilder ();
4444
45+ String [] launchCommand = null ;
46+
4547 if (SystemUtils .IS_OS_WINDOWS ) {
46- String [] windowsCommand ;
4748 if (System .getProperty ("sun.arch.data.model" ).equalsIgnoreCase ("64" )) {
48- windowsCommand = new String [] {"cmd" , "/c" , "TTREngine64.exe" };
49+ launchCommand = new String [] {"cmd" , "/c" , "TTREngine64.exe" };
4950 } else {
50- windowsCommand = new String [] {"cmd" , "/c" , "TTREngine.exe" };
51+ launchCommand = new String [] {"cmd" , "/c" , "TTREngine.exe" };
5152 }
52- pb .command (windowsCommand );
5353 logger .info ("Launching game from " + ConfigHandler .INSTALL_LOCATION );
5454 }
5555 if (SystemUtils .IS_OS_LINUX ) {
56- String linuxCommand = "./TTREngine" ;
56+ launchCommand = new String [] { "./TTREngine" } ;
5757
5858 // Make sure it's executable before running
5959 boolean result ;
@@ -80,8 +80,14 @@ public void run() {
8080 errorWindow .dispose ();
8181 return ;
8282 }
83- pb .command (linuxCommand );
84- logger .info ("Launching game from " + fullPath .getAbsolutePath ());
83+ }
84+
85+ if (launchCommand == null ) {
86+ logger .error ("Unable to determine operating system!" );
87+ ErrorWindow errorWindow =
88+ new ErrorWindow ("Unable to determine operating system!" , null );
89+ errorWindow .dispose ();
90+ return ;
8591 }
8692
8793 // dirty little trick to redirect the output
@@ -90,6 +96,7 @@ public void run() {
9096 pb .redirectOutput (ProcessBuilder .Redirect .PIPE );
9197 pb .redirectErrorStream (true );
9298 pb .directory (ConfigHandler .INSTALL_LOCATION );
99+ pb .command (launchCommand );
93100
94101 Map <String , String > env = pb .environment ();
95102 env .put ("TTR_GAMESERVER" , this .gameServer );
0 commit comments