mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Заменил реализацию скачивания ZIP файла
This commit is contained in:
parent
dc7e075789
commit
c4c50344fb
1 changed files with 12 additions and 1 deletions
|
@ -63,7 +63,7 @@ public void download(String base, List<DownloadTask> applies, Path dstDirFile, D
|
|||
}
|
||||
}
|
||||
public void downloadZip(String base, Path dstDirFile, DownloadCallback callback, DownloadTotalCallback totalCallback) throws IOException, URISyntaxException {
|
||||
try (CloseableHttpClient httpclient = HttpClients.custom()
|
||||
/*try (CloseableHttpClient httpclient = HttpClients.custom()
|
||||
.setRedirectStrategy(new LaxRedirectStrategy())
|
||||
.build()) {
|
||||
HttpGet get;
|
||||
|
@ -71,6 +71,17 @@ public void downloadZip(String base, Path dstDirFile, DownloadCallback callback,
|
|||
LogHelper.debug("Download ZIP URL: %s", u.toString());
|
||||
get = new HttpGet(u);
|
||||
httpclient.execute(get, new FileDownloadResponseHandler(dstDirFile, callback, totalCallback, true));
|
||||
}*/
|
||||
try (ZipInputStream input = IOHelper.newZipInput(new URL(base))) {
|
||||
for (ZipEntry entry = input.getNextEntry(); entry != null; entry = input.getNextEntry()) {
|
||||
if (entry.isDirectory())
|
||||
continue; // Skip directories
|
||||
// Unpack entry
|
||||
String name = entry.getName();
|
||||
LogHelper.subInfo("Downloading file: '%s'", name);
|
||||
Path fileName = IOHelper.toPath(name);
|
||||
transfer(input, dstDirFile.resolve(fileName), fileName.toString(), entry.getSize(), callback, totalCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue