From d3e5a31d6d47d1e8e0367c1efc551644ed1d7a00 Mon Sep 17 00:00:00 2001 From: Jago de Vreede Date: Mon, 23 Sep 2024 21:29:30 +0200 Subject: [PATCH] fix: Remove temp update files before starting new update process --- .github/workflows/early-access.yml | 2 -- .../io/github/jagodevreede/sdkmanui/updater/AutoUpdater.java | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml index 8620cc0..43a5fca 100644 --- a/.github/workflows/early-access.yml +++ b/.github/workflows/early-access.yml @@ -35,8 +35,6 @@ jobs: path: ~/.m2/repository save-always: true key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - name: Version id: vars diff --git a/sdkman-ui/src/main/java/io/github/jagodevreede/sdkmanui/updater/AutoUpdater.java b/sdkman-ui/src/main/java/io/github/jagodevreede/sdkmanui/updater/AutoUpdater.java index 22ae1d2..b8511d7 100644 --- a/sdkman-ui/src/main/java/io/github/jagodevreede/sdkmanui/updater/AutoUpdater.java +++ b/sdkman-ui/src/main/java/io/github/jagodevreede/sdkmanui/updater/AutoUpdater.java @@ -58,6 +58,9 @@ public void runUpdate() { try { File tempFile = new File(serviceRegistry.getApi().getBaseFolder(), "tmp/ui-update.tmp"); File destFile = new File(serviceRegistry.getApi().getBaseFolder(), "tmp/ui-update.bin"); + // Remove old first, as download could be interrupted + tempFile.delete(); + destFile.delete(); Optional downloadUrl = getDownloadUrl(getLatestGitHubRelease().getLatestReleaseDownloads()); if (!downloadUrl.isPresent()) {