Skip to content

Commit 247f6c7

Browse files
committed
refactor: check update jar existence instead of flag
1 parent 8e5cc8b commit 247f6c7

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/main/java/org/mcphackers/mcp/tasks/TaskDownloadUpdate.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,17 @@ protected Stage[] setStages() {
3636
boolean confirmed = mcp.updateDialogue(notes, latestVersion);
3737
if (confirmed) {
3838
log("Downloading update...");
39-
boolean downloaded = false;
4039
for (Object obj : releaseJson.getJSONArray("assets")) {
4140
if (obj instanceof JSONObject) {
4241
JSONObject assetObj = (JSONObject) obj;
4342
if (!assetObj.getString("name").endsWith(mcp.isGUI() ? "-GUI.jar" : "-CLI.jar")) {
4443
continue;
4544
}
4645
FileUtil.downloadFile(assetObj.getString("browser_download_url"), Paths.get(MCPPaths.UPDATE_JAR));
47-
downloaded = true;
4846
break;
4947
}
5048
}
51-
if (!downloaded) {
49+
if (!Files.exists(Paths.get(MCPPaths.UPDATE_JAR))) {
5250
IOException t = new IOException("No matching update asset found in release! Aborting");
5351
Util.throwExceptionInIDE(t);
5452
throw t;

0 commit comments

Comments
 (0)