Skip to content

Commit 9dc29c2

Browse files
committed
Fix auto updater on Windows systems
1 parent 28460d5 commit 9dc29c2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/net/clementraynaud/skoice/Updater.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,13 @@ private synchronized void update(String version, String expectedHash) {
139139
.transferFrom(Channels.newChannel(connection.getInputStream()), 0, Long.MAX_VALUE);
140140

141141
if (this.verifyFileIntegrity(tempUpdateFile, expectedHash)) {
142-
Files.move(tempUpdateFile.toPath(), finalUpdateFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
142+
Files.copy(tempUpdateFile.toPath(), finalUpdateFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
143143
this.downloadedVersion = version;
144144
this.plugin.getLogger().info(this.plugin.getLang().getMessage("logger.info.plugin-updated"));
145+
try {
146+
Files.delete(tempUpdateFile.toPath());
147+
} catch (IOException ignored) {
148+
}
145149
} else {
146150
throw new IOException("File integrity check failed");
147151
}

0 commit comments

Comments
 (0)