From be53eb66f8a63730f4def5640db6205678b4e9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Thu, 13 Apr 2017 09:28:25 +0200 Subject: NOISSUE implement mainJar support in OneSix format This allows customizing the main jar like any other library. --- .../minecraft/onesix/update/LibrariesTask.cpp | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'api/logic/minecraft/onesix/update/LibrariesTask.cpp') diff --git a/api/logic/minecraft/onesix/update/LibrariesTask.cpp b/api/logic/minecraft/onesix/update/LibrariesTask.cpp index 3e6bb12a..1b7e71d3 100644 --- a/api/logic/minecraft/onesix/update/LibrariesTask.cpp +++ b/api/logic/minecraft/onesix/update/LibrariesTask.cpp @@ -21,36 +21,36 @@ void LibrariesTask::executeTask() // Build a list of URLs that will need to be downloaded. std::shared_ptr profile = inst->getMinecraftProfile(); - // minecraft.jar for this version - { - QString version_id = profile->getMinecraftVersion(); - QString localPath = version_id + "/" + version_id + ".jar"; - QString urlstr = profile->getMainJarUrl(); - - auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name())); - auto metacache = ENV.metacache(); - auto entry = metacache->resolveEntry("versions", localPath); - job->addNetAction(Net::Download::makeCached(QUrl(urlstr), entry)); - downloadJob.reset(job); - } + auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name())); + downloadJob.reset(job); auto metacache = ENV.metacache(); QList brokenLocalLibs; QStringList failedFiles; + auto createJob = [&](const LibraryPtr & lib) + { + if(!lib) + { + emitFailed(tr("Null jar is specified in the metadata, aborting.")); + return; + } + auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles, inst->getLocalLibraryPath()); + for(auto dl : dls) + { + downloadJob->addNetAction(dl); + } + }; auto createJobs = [&](const QList & libs) { for (auto lib : libs) { - auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles, inst->getLocalLibraryPath()); - for(auto dl : dls) - { - downloadJob->addNetAction(dl); - } + createJob(lib); } }; createJobs(profile->getLibraries()); createJobs(profile->getNativeLibraries()); + createJob(profile->getMainJar()); // FIXME: this is never filled!!!! if (!brokenLocalLibs.empty()) -- cgit v1.2.3