mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-24 12:16:28 +01:00
Allow bootstrap server to announce unpacked update jars
Pack200 is dead, this is the start of its removal
This commit is contained in:
parent
27da4e8e4c
commit
662162392e
@ -61,11 +61,10 @@ public class Downloader implements Runnable, ProgressObservable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
File finalFile = new File(bootstrap.getBinariesDir(), System.currentTimeMillis() + ".jar.pack");
|
|
||||||
File tempFile = new File(finalFile.getParentFile(), finalFile.getName() + ".tmp");
|
|
||||||
URL updateUrl = HttpRequest.url(bootstrap.getProperties().getProperty("latestUrl"));
|
URL updateUrl = HttpRequest.url(bootstrap.getProperties().getProperty("latestUrl"));
|
||||||
|
|
||||||
log.info("Reading update URL " + updateUrl + "...");
|
log.info("Reading update URL " + updateUrl + "...");
|
||||||
|
List<LauncherBinary> binaries = new ArrayList<LauncherBinary>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String data = HttpRequest
|
String data = HttpRequest
|
||||||
@ -93,6 +92,16 @@ public class Downloader implements Runnable, ProgressObservable {
|
|||||||
|
|
||||||
checkInterrupted();
|
checkInterrupted();
|
||||||
|
|
||||||
|
boolean packed = true;
|
||||||
|
Object packedCheck = ((JSONObject) object).get("packed");
|
||||||
|
if (packedCheck == Boolean.FALSE) {
|
||||||
|
packed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String extension = packed ? ".jar.pack" : ".jar";
|
||||||
|
File finalFile = new File(bootstrap.getBinariesDir(), System.currentTimeMillis() + extension);
|
||||||
|
File tempFile = new File(finalFile.getParentFile(), finalFile.getName() + ".tmp");
|
||||||
|
|
||||||
log.info("Downloading " + url + " to " + tempFile.getAbsolutePath());
|
log.info("Downloading " + url + " to " + tempFile.getAbsolutePath());
|
||||||
|
|
||||||
httpRequest = HttpRequest.get(url);
|
httpRequest = HttpRequest.get(url);
|
||||||
@ -103,6 +112,9 @@ public class Downloader implements Runnable, ProgressObservable {
|
|||||||
|
|
||||||
finalFile.delete();
|
finalFile.delete();
|
||||||
tempFile.renameTo(finalFile);
|
tempFile.renameTo(finalFile);
|
||||||
|
|
||||||
|
LauncherBinary binary = new LauncherBinary(finalFile);
|
||||||
|
binaries.add(binary);
|
||||||
} finally {
|
} finally {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -113,9 +125,6 @@ public class Downloader implements Runnable, ProgressObservable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
LauncherBinary binary = new LauncherBinary(finalFile);
|
|
||||||
List<LauncherBinary> binaries = new ArrayList<LauncherBinary>();
|
|
||||||
binaries.add(binary);
|
|
||||||
bootstrap.launchExisting(binaries, false);
|
bootstrap.launchExisting(binaries, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user