mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-02-05 16:44:47 +08:00
fix: #729
This commit is contained in:
parent
53ff657106
commit
64d9fa7c6b
@ -23,6 +23,7 @@ import com.google.gson.JsonParseException;
|
|||||||
import org.jackhuang.hmcl.task.FileDownloadTask.IntegrityCheck;
|
import org.jackhuang.hmcl.task.FileDownloadTask.IntegrityCheck;
|
||||||
import org.jackhuang.hmcl.util.gson.JsonUtils;
|
import org.jackhuang.hmcl.util.gson.JsonUtils;
|
||||||
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
||||||
|
import org.jackhuang.hmcl.util.platform.SystemUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -37,7 +38,7 @@ public class RemoteVersion {
|
|||||||
String jarHash = Optional.ofNullable(response.get("jarsha1")).map(JsonElement::getAsString).orElse(null);
|
String jarHash = Optional.ofNullable(response.get("jarsha1")).map(JsonElement::getAsString).orElse(null);
|
||||||
String packXZUrl = Optional.ofNullable(response.get("packxz")).map(JsonElement::getAsString).orElse(null);
|
String packXZUrl = Optional.ofNullable(response.get("packxz")).map(JsonElement::getAsString).orElse(null);
|
||||||
String packXZHash = Optional.ofNullable(response.get("packxzsha1")).map(JsonElement::getAsString).orElse(null);
|
String packXZHash = Optional.ofNullable(response.get("packxzsha1")).map(JsonElement::getAsString).orElse(null);
|
||||||
if (packXZUrl != null && packXZHash != null) {
|
if (SystemUtils.JRE_CAPABILITY_PACK200 && packXZUrl != null && packXZHash != null) {
|
||||||
return new RemoteVersion(version, packXZUrl, Type.PACK_XZ, new IntegrityCheck("SHA-1", packXZHash));
|
return new RemoteVersion(version, packXZUrl, Type.PACK_XZ, new IntegrityCheck("SHA-1", packXZHash));
|
||||||
} else if (jarUrl != null && jarHash != null) {
|
} else if (jarUrl != null && jarHash != null) {
|
||||||
return new RemoteVersion(version, jarUrl, Type.JAR, new IntegrityCheck("SHA-1", jarHash));
|
return new RemoteVersion(version, jarUrl, Type.JAR, new IntegrityCheck("SHA-1", jarHash));
|
||||||
|
@ -28,6 +28,7 @@ import org.jackhuang.hmcl.task.Task;
|
|||||||
import org.jackhuang.hmcl.util.io.FileUtils;
|
import org.jackhuang.hmcl.util.io.FileUtils;
|
||||||
import org.jackhuang.hmcl.util.io.IOUtils;
|
import org.jackhuang.hmcl.util.io.IOUtils;
|
||||||
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
||||||
|
import org.jackhuang.hmcl.util.platform.SystemUtils;
|
||||||
import org.tukaani.xz.XZInputStream;
|
import org.tukaani.xz.XZInputStream;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@ -125,7 +126,7 @@ public class LibraryDownloadTask extends Task<Void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testURLExistence(url)) {
|
if (SystemUtils.JRE_CAPABILITY_PACK200 && testURLExistence(url)) {
|
||||||
List<URL> urls = dependencyManager.getDownloadProvider().injectURLWithCandidates(url + ".pack.xz");
|
List<URL> urls = dependencyManager.getDownloadProvider().injectURLWithCandidates(url + ".pack.xz");
|
||||||
task = new FileDownloadTask(urls, xzFile, null);
|
task = new FileDownloadTask(urls, xzFile, null);
|
||||||
task.setCacheRepository(cacheRepository);
|
task.setCacheRepository(cacheRepository);
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.util.platform;
|
package org.jackhuang.hmcl.util.platform;
|
||||||
|
|
||||||
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@ -26,6 +28,8 @@ import java.util.List;
|
|||||||
public final class SystemUtils {
|
public final class SystemUtils {
|
||||||
private SystemUtils() {}
|
private SystemUtils() {}
|
||||||
|
|
||||||
|
public static final boolean JRE_CAPABILITY_PACK200 = Lang.test(() -> Class.forName("java.util.jar.Pack200"));
|
||||||
|
|
||||||
public static int callExternalProcess(String... command) throws IOException, InterruptedException {
|
public static int callExternalProcess(String... command) throws IOException, InterruptedException {
|
||||||
return callExternalProcess(Arrays.asList(command));
|
return callExternalProcess(Arrays.asList(command));
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,14 @@ If you want to submit a pull request, there're some requirements:
|
|||||||
* Compiler: Java 1.8.
|
* Compiler: Java 1.8.
|
||||||
* Do NOT modify `gradle` files.
|
* Do NOT modify `gradle` files.
|
||||||
|
|
||||||
|
### Compilation
|
||||||
|
|
||||||
|
Simply execute following command:
|
||||||
|
```bash
|
||||||
|
./gradlew clean build
|
||||||
|
```
|
||||||
|
Make sure you have Java installed with Pack200 and JavaFX 8 at least. Liberica full JDK 8~11 is recommended.
|
||||||
|
|
||||||
## JVM Options (for debugging)
|
## JVM Options (for debugging)
|
||||||
|Parameter|Description|
|
|Parameter|Description|
|
||||||
|---------|-----------|
|
|---------|-----------|
|
||||||
|
Loading…
Reference in New Issue
Block a user