4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-09-30 04:59:05 +02:00

AddMod.java ist now writing the json to the File correctly

This commit is contained in:
Timo Ley 2020-06-18 22:29:32 +02:00
parent 5179c3faee
commit 3d3f914d2c
2 changed files with 16 additions and 7 deletions

View file

@ -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 <curseforge url>");
}

View file

@ -21,4 +21,9 @@ public class ModpackJsonHandler {
}
return null;
}
public File getFile() {
return modpackJsonFile;
}
}