From aa4d6d7c30289e5e469fa2fb1c11c02775ff49e8 Mon Sep 17 00:00:00 2001 From: Vhati Date: Mon, 10 Mar 2014 06:11:40 -0400 Subject: [PATCH] Added an error popup when the jar is double-clicked --- skel_common/readme_changelog.txt | 1 + src/main/java/net/vhati/modmanager/FTLModManager.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/skel_common/readme_changelog.txt b/skel_common/readme_changelog.txt index 37ac7f9..e1b3302 100644 --- a/skel_common/readme_changelog.txt +++ b/skel_common/readme_changelog.txt @@ -9,6 +9,7 @@ Changelog - Changed modman.exe to fail rather than use VirtualStore - Added modman_admin.exe, which always runs as administrator - Added a Validate warning for junk files whose names end with a tilde +- Added an error popup when the jar is double-clicked - Minor optimizations to reduce memory usage 1.4: diff --git a/src/main/java/net/vhati/modmanager/FTLModManager.java b/src/main/java/net/vhati/modmanager/FTLModManager.java index 341e143..3f5c00b 100644 --- a/src/main/java/net/vhati/modmanager/FTLModManager.java +++ b/src/main/java/net/vhati/modmanager/FTLModManager.java @@ -51,6 +51,14 @@ public class FTLModManager { 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") ) ); + // Nag if the jar was double-clicked. + if ( new File("./mods/").exists() == false ) { + String currentPath = new File(".").getAbsoluteFile().getParentFile().getAbsolutePath(); + 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.exit( 1 ); + } + File configFile = new File( "modman.cfg" );