InstalledGameVersionCatalog
This commit is contained in:
@@ -43,7 +43,7 @@ public class LibrariesDownloadTaskFactory : INetworkTaskFactory
|
||||
{
|
||||
_libsToDownload.Add(l);
|
||||
}
|
||||
//TODO: replace with actual native assets check
|
||||
//TODO: replace with actual native libraries check
|
||||
else if (!nativeDirExists && l is Libraries.NativeLib)
|
||||
{
|
||||
_libsToDownload.Add(l);
|
||||
@@ -79,18 +79,15 @@ public class LibrariesDownloadTaskFactory : INetworkTaskFactory
|
||||
if (l is Libraries.NativeLib n)
|
||||
{
|
||||
await using var zipf = File.OpenRead(n.jarFilePath);
|
||||
//TODO: replace following code with manual extraction
|
||||
ZipFile.ExtractToDirectory(zipf, _nativesDir.ToString(), true);
|
||||
if (n.extractionOptions?.exclude != null)
|
||||
using var archive = new ZipArchive(zipf);
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
foreach (var excluded in n.extractionOptions.exclude)
|
||||
{
|
||||
IOPath path = Path.Concat(_nativesDir, excluded);
|
||||
if(Directory.Exists(path))
|
||||
Directory.Delete(path);
|
||||
if(File.Exists(path))
|
||||
File.Delete(path);
|
||||
}
|
||||
if (n.extractionOptions?.exclude?.Contains(entry.FullName) is true or null)
|
||||
continue;
|
||||
|
||||
var real_path = Path.Concat(_nativesDir, entry.FullName);
|
||||
Directory.Create(real_path.ParentDir());
|
||||
entry.ExtractToFile(real_path.ToString(), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ public class MyModpackV1DownloadTaskFactory : INetworkTaskFactory
|
||||
if(string.IsNullOrEmpty(_modpack.zip.url))
|
||||
throw new Exception($"modpack '{_modpack.name}' doesn't have a url to download");
|
||||
|
||||
var _archivePath = Path.Concat("downloads/modpacks", _modpack.name + ".zip");
|
||||
var _archivePath = Path.Concat(PathHelper.GetCacheDir(), "modpacks", _modpack.name + ".zip");
|
||||
await NetworkHelper.DownloadFile(_modpack.zip.url, _archivePath, ct, pr.AddBytesCount);
|
||||
|
||||
await using var zipf = File.OpenRead(_archivePath);
|
||||
|
||||
Reference in New Issue
Block a user