This commit is contained in:
parent
1678e3af1d
commit
65c52cf1cc
1 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue