Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static int preChecks() {
- try {
- String dir = WPlanner.class.getProtectionDomain().getCodeSource().getLocation().getPath();
- if (dir.endsWith(".jar"))
- dir = dir.substring(0, dir.lastIndexOf("/") + 1);
- JOptionPane.showMessageDialog(null, dir);
- System.out.println(dir);
- /*
- * When dir == /C:/Users/Blake/Documents/workspace/WPlanner/bin/
- * == ./
- * it loads "/data/objects/" fine
- * When dir == /C:/Program%20Files%20(x86)/TestProgram/WPlanner/
- * it doesn't
- */
- OBJECTS_FOLDER = dir + OBJECTS_FOLDER;
- FENCES_FOLDER = dir + FENCES_FOLDER;
- if (Preferences.userRoot().nodeExists(WURM_REGISTRY))
- if (Preferences.userRoot().node(WURM_REGISTRY).get("wurm_dir", "FAIL").equals("FAIL"))
- return 3;
- else
- if ((new File(OBJECTS_FOLDER)).exists())
- if ((new File(FENCES_FOLDER)).exists())
- return 1;
- else
- return 9;
- else
- return 8;
- else
- return 2;
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- return 5;
- }
Add Comment
Please, Sign In to add comment