From eb6cefafa0385e039779bbf15fe6d8c261791d2b Mon Sep 17 00:00:00 2001 From: Ian Brown Date: Tue, 30 Apr 2019 19:35:29 +0100 Subject: [PATCH] mac paths --- bgtools/.idea/misc.xml | 2 +- bgtools/src/net/ijbrown/bgtools/lmp/Config.java | 16 ++++++++++++++++ .../net/ijbrown/bgtools/lmp/GobExtractor.java | 6 ++++-- .../net/ijbrown/bgtools/lmp/ScriptDecode.java | 16 +++++++++++----- 4 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 bgtools/src/net/ijbrown/bgtools/lmp/Config.java diff --git a/bgtools/.idea/misc.xml b/bgtools/.idea/misc.xml index beecf01..96348f4 100644 --- a/bgtools/.idea/misc.xml +++ b/bgtools/.idea/misc.xml @@ -20,7 +20,7 @@ http://www.w3.org/1999/xhtml - + diff --git a/bgtools/src/net/ijbrown/bgtools/lmp/Config.java b/bgtools/src/net/ijbrown/bgtools/lmp/Config.java new file mode 100644 index 0000000..43502ba --- /dev/null +++ b/bgtools/src/net/ijbrown/bgtools/lmp/Config.java @@ -0,0 +1,16 @@ +package net.ijbrown.bgtools.lmp; + +public class Config { + public String getRootDir() + { + String osName = System.getProperty("os.name").toLowerCase(); + boolean isMacOs = osName.startsWith("mac os x"); + + String rootDir = "/emu/bgda//"; + if (isMacOs){ + String home = System.getProperty("user.home"); + rootDir = home+"/DARK_ALLIANCE/"; + } + return rootDir; + } +} diff --git a/bgtools/src/net/ijbrown/bgtools/lmp/GobExtractor.java b/bgtools/src/net/ijbrown/bgtools/lmp/GobExtractor.java index 8566385..c625cf0 100644 --- a/bgtools/src/net/ijbrown/bgtools/lmp/GobExtractor.java +++ b/bgtools/src/net/ijbrown/bgtools/lmp/GobExtractor.java @@ -24,8 +24,10 @@ public class GobExtractor { public static void main(String[] args) throws IOException { - String outDir = "/emu/bgda/BG/DATA_extracted/"; - String inDir = "/emu/bgda/BG/DATA/"; + String root = "/Users/ian/DARK_ALLIANCE/"; + + String outDir = root+"BG/DATA_extracted/"; + String inDir = root+"BG/DATA/"; File outDirFile = new File(outDir); outDirFile.mkdirs(); diff --git a/bgtools/src/net/ijbrown/bgtools/lmp/ScriptDecode.java b/bgtools/src/net/ijbrown/bgtools/lmp/ScriptDecode.java index 6e0420b..ef10c7f 100644 --- a/bgtools/src/net/ijbrown/bgtools/lmp/ScriptDecode.java +++ b/bgtools/src/net/ijbrown/bgtools/lmp/ScriptDecode.java @@ -28,18 +28,24 @@ public class ScriptDecode { public static void main(String[] args) throws IOException { - ScriptDecode obj = new ScriptDecode(); - obj.decode("tavern"); - // obj.decode("cellar1"); + ScriptDecode obj = new ScriptDecode(new Config().getRootDir()); + obj.decode("tavern"); + obj.decode("cellar1"); obj.decode("cuttown"); } + private final String rootDir; + + public ScriptDecode(String rootDir) { + this.rootDir = rootDir; + } + private void decode(String levelName) throws IOException { - String rootDir = "/emu/bgda/BG/DATA_extracted/"; + String lmpName = levelName; - String outDir = rootDir + lmpName + "/" + lmpName + "_lmp/"; + String outDir = rootDir + "/BG/DATA_extracted/" + lmpName + "/" + lmpName + "_lmp/"; File outDirFile = new File(outDir); outDirFile.mkdirs();