Skip to content

Commit 4de9d6f

Browse files
committed
Update updater to use the stable channel as fallback
1 parent e890852 commit 4de9d6f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

application-updater/src/main/java/com/zyneonstudios/application/ApplicationLauncher.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ private boolean validate() {
9595
}
9696

9797
public boolean update(String updateChannelId, boolean overwrite) {
98+
boolean updated = false;
9899
Launcher.getLogger().log("[UPDATER] Connecting to update channel "+updateChannelId+"...");
99100
try {
100101
JsonArray versions = new Gson().fromJson(GsonUtil.getFromURL("https://raw.githubusercontent.com/zyneonstudios/nexus-nex/main/application/index.json"), JsonObject.class).getAsJsonArray("versions");
@@ -114,7 +115,8 @@ public boolean update(String updateChannelId, boolean overwrite) {
114115
app.delete();
115116
} else {
116117
Launcher.getLogger().log("[UPDATER] Version "+this.version+" is already installed! Skipping update process...");
117-
return true;
118+
updated = true;
119+
break;
118120
}
119121
}
120122
Launcher.getLogger().log("[UPDATER] Downloading...");
@@ -124,7 +126,8 @@ public boolean update(String updateChannelId, boolean overwrite) {
124126
this.version = newVersion;
125127
config.set("updater.installed.info.version", this.version);
126128
config.set("updater.installed.info.channel", this.updateChannel);
127-
return true;
129+
updated = true;
130+
break;
128131
} else {
129132
Launcher.getLogger().error("[UPDATER] Couldn't download new version!");
130133
}
@@ -135,7 +138,10 @@ public boolean update(String updateChannelId, boolean overwrite) {
135138
} catch (Exception e) {
136139
throw new RuntimeException(e);
137140
}
138-
return false;
141+
if(!updated) {
142+
return update("stable",overwrite);
143+
}
144+
return updated;
139145
}
140146

141147
public int launch(String updateChannelId) {

0 commit comments

Comments
 (0)