Follow-up to af667a4.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2016-12-08 20:05:08 -05:00
parent af667a48d5
commit 38daee002f

View File

@ -134,7 +134,8 @@ public class Opsu extends StateBasedGame {
"- Another program is bound to port %d. " + "- Another program is bound to port %d. " +
"You can change the port opsu! uses by editing the \"Port\" field in the configuration file.", "You can change the port opsu! uses by editing the \"Port\" field in the configuration file.",
Options.getPort() Options.getPort()
) ),
false
); );
} }
@ -171,7 +172,7 @@ public class Opsu extends StateBasedGame {
try { try {
DBController.init(); DBController.init();
} catch (UnsatisfiedLinkError e) { } catch (UnsatisfiedLinkError e) {
errorAndExit(e, "The databases could not be initialized."); errorAndExit(e, "The databases could not be initialized.", true);
} }
// check if just updated // check if just updated
@ -218,7 +219,7 @@ public class Opsu extends StateBasedGame {
} }
} }
} catch (SlickException e) { } catch (SlickException e) {
errorAndExit(e, "An error occurred while creating the game container."); errorAndExit(e, "An error occurred while creating the game container.", true);
} }
} }
@ -284,15 +285,16 @@ public class Opsu extends StateBasedGame {
* Throws an error and exits the application with the given message. * Throws an error and exits the application with the given message.
* @param e the exception that caused the crash * @param e the exception that caused the crash
* @param message the message to display * @param message the message to display
* @param report whether to ask to report the error
*/ */
private static void errorAndExit(Throwable e, String message) { private static void errorAndExit(Throwable e, String message, boolean report) {
// JARs will not run properly inside directories containing '!' // JARs will not run properly inside directories containing '!'
// http://bugs.java.com/view_bug.do?bug_id=4523159 // http://bugs.java.com/view_bug.do?bug_id=4523159
if (Utils.isJarRunning() && Utils.getRunningDirectory() != null && if (Utils.isJarRunning() && Utils.getRunningDirectory() != null &&
Utils.getRunningDirectory().getAbsolutePath().indexOf('!') != -1) Utils.getRunningDirectory().getAbsolutePath().indexOf('!') != -1)
ErrorHandler.error("JARs cannot be run from some paths containing '!'. Please move or rename the file and try again.", null, false); ErrorHandler.error("JARs cannot be run from some paths containing '!'. Please move or rename the file and try again.", null, false);
else else
ErrorHandler.error(message, e, true); ErrorHandler.error(message, e, report);
System.exit(1); System.exit(1);
} }
} }