diff --git a/src/main/java/ley/anvil/modpacktools/commands/AddMod.java b/src/main/java/ley/anvil/modpacktools/commands/AddMod.java index dc88781..276099b 100644 --- a/src/main/java/ley/anvil/modpacktools/commands/AddMod.java +++ b/src/main/java/ley/anvil/modpacktools/commands/AddMod.java @@ -60,7 +60,6 @@ public class AddMod implements ICommand { if(matcher.find()) { fileID = Integer.parseInt(matcher.group(0)); } - File manifestFile = new File(Main.CONFIG.JAR_LOCATION, Main.CONFIG.CONFIG.getPath(String.class, "Locations", "manifestFile")); System.out.println("Reading Addonscript"); //Get Mods in manifest file //Check if Mod already exsits @@ -86,12 +85,7 @@ public class AddMod implements ICommand { version.relations = new ArrayList<>(); } version.relations.add(rel); - //Overwrite Old Manifest File - FileWriter manifestWriter = new FileWriter(manifestFile, false); - System.out.println("Printing Manifest"); - json.write(manifestWriter); - manifestWriter.close(); - }catch(CurseException | IOException e) { + }catch(CurseException e) { e.printStackTrace(); } }else { @@ -104,6 +98,16 @@ public class AddMod implements ICommand { } version.relations.add(rel); } + //Overwrite Old Manifest File + FileWriter manifestWriter = null; + try { + manifestWriter = new FileWriter(Main.MPJH.getFile(), false); + System.out.println("Printing Manifest"); + json.write(manifestWriter); + manifestWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } }else { return CommandReturn.fail("Syntax: addmod "); } diff --git a/src/main/java/ley/anvil/modpacktools/util/ModpackJsonHandler.java b/src/main/java/ley/anvil/modpacktools/util/ModpackJsonHandler.java index e8efd32..e27148a 100644 --- a/src/main/java/ley/anvil/modpacktools/util/ModpackJsonHandler.java +++ b/src/main/java/ley/anvil/modpacktools/util/ModpackJsonHandler.java @@ -21,4 +21,9 @@ public class ModpackJsonHandler { } return null; } + + public File getFile() { + return modpackJsonFile; + } + }