diff --git a/launcher-bootstrap/src/main/java/com/skcraft/launcher/bootstrap/Downloader.java b/launcher-bootstrap/src/main/java/com/skcraft/launcher/bootstrap/Downloader.java index e11d5dc..c17c181 100644 --- a/launcher-bootstrap/src/main/java/com/skcraft/launcher/bootstrap/Downloader.java +++ b/launcher-bootstrap/src/main/java/com/skcraft/launcher/bootstrap/Downloader.java @@ -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")); log.info("Reading update URL " + updateUrl + "..."); + List binaries = new ArrayList(); try { String data = HttpRequest @@ -93,6 +92,16 @@ public class Downloader implements Runnable, ProgressObservable { 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()); httpRequest = HttpRequest.get(url); @@ -103,6 +112,9 @@ public class Downloader implements Runnable, ProgressObservable { finalFile.delete(); tempFile.renameTo(finalFile); + + LauncherBinary binary = new LauncherBinary(finalFile); + binaries.add(binary); } finally { SwingUtilities.invokeLater(new Runnable() { @Override @@ -113,9 +125,6 @@ public class Downloader implements Runnable, ProgressObservable { }); } - LauncherBinary binary = new LauncherBinary(finalFile); - List binaries = new ArrayList(); - binaries.add(binary); bootstrap.launchExisting(binaries, false); }