From bc69fedfe6babaaa94f48733e9ab399472517523 Mon Sep 17 00:00:00 2001 From: robin4002 Date: Mon, 13 Jun 2016 16:43:11 +0200 Subject: [PATCH] change build number, fix lib download --- build.gradle | 14 ++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- .../common/ProcessInstall.java | 34 ++++++++++++++----- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 3ea034a..bf2b1ea 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ repositories { group = 'net.minecraftforgefrance' archivesBaseName = 'installer' -version = '2.1.3' +version = '2.2.0' targetCompatibility = '1.6' sourceCompatibility = '1.6' @@ -82,11 +82,11 @@ task updaterJar(type: Jar, dependsOn: "jar"){ task fullUpdaterJar(type: Jar, dependsOn: "updaterJar"){ inputs.file jar.archivePath from(configurations.compile.collect { zipTree(it).matching { - include 'org/tukaani/**/*.class' - include 'utybo/minkj/**/*.class' - include 'argo/**/*.class' - } }) - archiveName = "updater-${project.version}-full.jar" + include 'org/tukaani/**/*.class' + include 'utybo/minkj/**/*.class' + include 'argo/**/*.class' + }}) + archiveName = "updater-${project.version}.jar" } fullUpdaterJar.doFirst { @@ -108,5 +108,5 @@ jar { } task wrapper(type: Wrapper) { - gradleVersion = '1.12' + gradleVersion = '2.7' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 588ea07..88f8e51 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip diff --git a/src/main/java/fr/minecraftforgefrance/common/ProcessInstall.java b/src/main/java/fr/minecraftforgefrance/common/ProcessInstall.java index a8d1834..3279dd2 100644 --- a/src/main/java/fr/minecraftforgefrance/common/ProcessInstall.java +++ b/src/main/java/fr/minecraftforgefrance/common/ProcessInstall.java @@ -54,6 +54,8 @@ public class ProcessInstall implements Runnable public final File mcDir; public final File modPackDir; + + private boolean error = false; public ProcessInstall(FileChecker file, IInstallRunner runner, File mcDir, String preset) { @@ -103,7 +105,10 @@ public void run() { this.downloadPreset(); } - this.finish(); + if(!error) + { + this.finish(); + } } public void deleteDeprecated() @@ -125,6 +130,7 @@ public void deleteDeprecated() /** * Check for missing libraries + * * @return the sum of all missing libs's size */ private int checkMissingLibs() @@ -175,7 +181,7 @@ public String apply(JsonNode node) String libURL = DownloadUtils.LIBRARIES_URL; if(library.isStringValue("url")) { - libURL = library.getStringValue("url") + "/"; + libURL = library.getStringValue("url") + (!library.getStringValue("url").endsWith("/") ? "/" : ""); } if(libPath.exists() && DownloadUtils.checksumValid(libPath, checksums)) { @@ -202,7 +208,7 @@ public String apply(JsonNode node) URLConnection connection = url.openConnection(); int fileLength = connection.getContentLength(); max += fileLength; - missingLibs.add(new LibEntry(libURL, libName, libPath, pack, fileLength, xz)); + this.missingLibs.add(new LibEntry(libURL, libName, libPath, pack, fileLength, xz)); } catch(IOException e) { @@ -215,6 +221,7 @@ public String apply(JsonNode node) /** * Get the sum of all files's size to download + * * @return the size */ private int getTotalDownloadSize() @@ -249,6 +256,8 @@ public void downloadMod() this.installFrame.dispose(); JOptionPane.showMessageDialog(null, LANG.getTranslation("err.cannotdownload") + " : " + entry.getUrl().toString(), LANG.getTranslation("misc.error"), JOptionPane.ERROR_MESSAGE); Thread.currentThread().interrupt(); + this.error = true; + return; } } } @@ -262,11 +271,14 @@ public void downloadLib() this.changeCurrentDownloadText(String.format(LANG.getTranslation("proc.downloadinglib"), entry.getName())); try { - if(!DownloadUtils.downloadFile(new URL(entry.getUrl()), entry.getPackDest(), this.installFrame)) + File filePath = entry.isXZ() ? entry.getPackDest() : entry.getDest(); + if(!DownloadUtils.downloadFile(new URL(entry.getUrl()), filePath, this.installFrame)) { this.installFrame.dispose(); - JOptionPane.showMessageDialog(null, LANG.getTranslation("err.cannotdownload") + " : " + entry.getUrl().toString() + DownloadUtils.PACK_NAME, LANG.getTranslation("misc.error"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, LANG.getTranslation("err.cannotdownload") + " : " + entry.getUrl().toString() + (entry.isXZ() ? DownloadUtils.PACK_NAME : ""), LANG.getTranslation("misc.error"), JOptionPane.ERROR_MESSAGE); Thread.currentThread().interrupt(); + this.error = true; + return; } else if(entry.isXZ()) { @@ -329,6 +341,8 @@ public int size() this.installFrame.dispose(); JOptionPane.showMessageDialog(null, LANG.getTranslation("err.cannotdownload") + " : " + RemoteInfoReader.instance().getPresetUrl() + this.preset + "/" + DownloadUtils.escapeURIPathParam(file), LANG.getTranslation("misc.error"), JOptionPane.ERROR_MESSAGE); Thread.currentThread().interrupt(); + this.error = true; + return; } } catch(HeadlessException e) @@ -401,9 +415,13 @@ private void createOrUpdateProfile() /** * determine if the profile exist and if it is valid in the file launcher_profiles.json - * @param profiles JsonRootNode of the file launcher_profiles.json - * @param modpackName name of the modpack - * @param displayName display name of the modpack + * + * @param profiles + * JsonRootNode of the file launcher_profiles.json + * @param modpackName + * name of the modpack + * @param displayName + * display name of the modpack * @return true if the profile exist and is valid */ private boolean isProfileValid(JsonRootNode profiles, String modpackName, String displayName)