Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Fix libraries issues on updates
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldieeins committed Jun 16, 2024
1 parent 969214a commit 8c9069f
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ public static boolean update(ReadableInstance localInstance) {
try {
String path = Application.getInstancePath() + "instances/" + onlineInstance.getId() + "/";
File pack = new File(path + "meta/pack.zip");
File mods = new File(path + "/mods/");
File libraries = new File(path + "/libraries/");
File mods = new File(path + "mods/");
File libraries = new File(path + "libraries/");
Main.getLogger().log("[ZYNDEX] Deleting old libraries...");
String lT = "!";
try {
FileUtil.deleteFolder(libraries);
} catch (Exception ignore) {}
} catch (Exception e) {
lT = ": "+e.getMessage();
}
if(!libraries.exists()) {
Main.getLogger().log("[ZYNDEX] Old libraries deleted!");
} else {
Main.getLogger().error("[ZYNDEX] Couldn't delete old libraries"+lT);
}
Main.getLogger().log("[ZYNDEX] Checking if old pack file exists...");
if (pack.exists()) {
Expand Down Expand Up @@ -107,8 +112,16 @@ public static boolean update(ReadableInstance localInstance) {
pack = FileUtil.downloadFile(onlineInstance.getDownloadUrl(), path + "meta/pack.zip");
Main.getLogger().log("[ZYNDEX] New pack file downloaded!");
Main.getLogger().log("[ZYNDEX] Deleting old mods...");
if (!mods.mkdirs()) {
String mT = "!";
try {
FileUtil.deleteFolder(mods);
} catch (Exception e) {
mT = ": "+e.getMessage();
}
if(!mods.exists()) {
Main.getLogger().log("[ZYNDEX] Old mods deleted!");
} else {
Main.getLogger().error("[ZYNDEX] Couldn't delete old mods"+lT);
}
Main.getLogger().log("[ZYNDEX] Old mods deleted!");
Main.getLogger().log("[ZYNDEX] Unzipping pack file...");
Expand Down

0 comments on commit 8c9069f

Please sign in to comment.