This commit is contained in:
huanghongxun
2020-06-14 19:51:46 +08:00
parent 53ff657106
commit 64d9fa7c6b
4 changed files with 16 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.IOUtils;
import org.jackhuang.hmcl.util.io.NetworkUtils;
import org.jackhuang.hmcl.util.platform.SystemUtils;
import org.tukaani.xz.XZInputStream;
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");
task = new FileDownloadTask(urls, xzFile, null);
task.setCacheRepository(cacheRepository);

View File

@@ -17,6 +17,8 @@
*/
package org.jackhuang.hmcl.util.platform;
import org.jackhuang.hmcl.util.Lang;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -26,6 +28,8 @@ import java.util.List;
public final class 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 {
return callExternalProcess(Arrays.asList(command));
}