diff --git a/Loader/src/main/java/de/com/baseband/launcher/Loader.java b/Loader/src/main/java/de/com/baseband/launcher/Loader.java index 44478ce..94ac76c 100644 --- a/Loader/src/main/java/de/com/baseband/launcher/Loader.java +++ b/Loader/src/main/java/de/com/baseband/launcher/Loader.java @@ -392,9 +392,14 @@ public class Loader implements Util { InputStream stream = urlStream; if(filename != null) { byte[] bytes = new StreamReader(stream).readAllAsBytes(); - try(FileOutputStream os = new FileOutputStream(filename)) { + try(FileOutputStream os = new FileOutputStream(filename + ".tmp")) { os.write(bytes); } catch (IOException ignored) { } + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + File f = new File(filename); + f.delete(); + new File(filename + ".tmp").renameTo(f); + })); stream = new ByteArrayInputStream(bytes); } ZipInputStream jar = new ZipInputStream(stream);