diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2024-09-22 01:13:11 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2024-09-22 01:13:11 -0400 |
commit | 2b3d6eeb08fac367b2e2f4ed0528bfaeeedca686 (patch) | |
tree | 23cf821ce9ab536dfd44a74db26dba6ea4f9fb90 /src/main/java/net/sowgro/npehero/Driver.java | |
parent | da1b21264caf8fd42a1a809c538e2128435160f9 (diff) | |
download | NPEhero-2b3d6eeb08fac367b2e2f4ed0528bfaeeedca686.tar.gz NPEhero-2b3d6eeb08fac367b2e2f4ed0528bfaeeedca686.tar.bz2 NPEhero-2b3d6eeb08fac367b2e2f4ed0528bfaeeedca686.zip |
Contain all gamedata in .npehero
Diffstat (limited to 'src/main/java/net/sowgro/npehero/Driver.java')
-rwxr-xr-x | src/main/java/net/sowgro/npehero/Driver.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/net/sowgro/npehero/Driver.java b/src/main/java/net/sowgro/npehero/Driver.java index 89381aa..3be414c 100755 --- a/src/main/java/net/sowgro/npehero/Driver.java +++ b/src/main/java/net/sowgro/npehero/Driver.java @@ -17,6 +17,7 @@ import net.sowgro.npehero.levelapi.Levels; import net.sowgro.npehero.main.*; import net.sowgro.npehero.gui.MainMenu; +import java.io.File; import java.io.IOException; import java.net.URL; import java.util.Stack; @@ -25,6 +26,7 @@ import java.util.Stack; public class Driver extends Application { public static final Image MENU_BACKGROUND = new Image(Driver.class.getResource("mountains.png").toExternalForm()); + public static final File BASE_DIR = new File(".npehero"); public static Stage primaryStage; public static ScrollPane primaryPane = new ScrollPane(); @@ -88,6 +90,17 @@ public class Driver extends Application primaryStage.show(); Stack<String> errors = new Stack<>(); + System.out.println("Loading .npehero..."); + try { + if (!BASE_DIR.exists() && !BASE_DIR.mkdir()) { + throw new IOException(); + } + if (!BASE_DIR.isDirectory()) { + throw new IOException(); + } + } catch (Exception e) { + errors.push("Failed to locate .npehero\n"+e); + } System.out.println("Loading settings..."); try { Settings.read(); |