aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/update/LibrariesTask.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-08-15 12:16:00 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-08-15 12:16:00 +0300
commitc94ee67077076fdfb3ad04e93a0de2ae32b6a4e5 (patch)
tree437dec3be224cae5e229eeaa4ac9ebeedffd03e3 /launcher/minecraft/update/LibrariesTask.cpp
parent019e5ca3e819f5daf9933bc0fb091784b0ca561f (diff)
parent8f5bb982cd27dd9158b63d826769c168455a139b (diff)
downloadPrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.gz
PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.bz2
PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into curseforge-url-handle3
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/minecraft/update/LibrariesTask.cpp')
-rw-r--r--launcher/minecraft/update/LibrariesTask.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/launcher/minecraft/update/LibrariesTask.cpp b/launcher/minecraft/update/LibrariesTask.cpp
index 9d1c0295..1581b32e 100644
--- a/launcher/minecraft/update/LibrariesTask.cpp
+++ b/launcher/minecraft/update/LibrariesTask.cpp
@@ -5,7 +5,7 @@
#include "Application.h"
-LibrariesTask::LibrariesTask(MinecraftInstance * inst)
+LibrariesTask::LibrariesTask(MinecraftInstance* inst)
{
m_inst = inst;
}
@@ -14,7 +14,7 @@ void LibrariesTask::executeTask()
{
setStatus(tr("Downloading required library files..."));
qDebug() << m_inst->name() << ": downloading libraries";
- MinecraftInstance *inst = (MinecraftInstance *)m_inst;
+ MinecraftInstance* inst = (MinecraftInstance*)m_inst;
// Build a list of URLs that will need to be downloaded.
auto components = inst->getPackProfile();
@@ -25,18 +25,14 @@ void LibrariesTask::executeTask()
auto metacache = APPLICATION->metacache();
- auto processArtifactPool = [&](const QList<LibraryPtr> & pool, QStringList & errors, const QString & localPath)
- {
- for (auto lib : pool)
- {
- if(!lib)
- {
+ auto processArtifactPool = [&](const QList<LibraryPtr>& pool, QStringList& errors, const QString& localPath) {
+ for (auto lib : pool) {
+ if (!lib) {
emitFailed(tr("Null jar is specified in the metadata, aborting."));
return false;
}
auto dls = lib->getDownloads(inst->runtimeContext(), metacache.get(), errors, localPath);
- for(auto dl : dls)
- {
+ for (auto dl : dls) {
downloadJob->addNetAction(dl);
}
}
@@ -48,8 +44,7 @@ void LibrariesTask::executeTask()
libArtifactPool.append(profile->getLibraries());
libArtifactPool.append(profile->getNativeLibraries());
libArtifactPool.append(profile->getMavenFiles());
- for (auto agent : profile->getAgents())
- {
+ for (auto agent : profile->getAgents()) {
libArtifactPool.append(agent->library());
}
libArtifactPool.append(profile->getMainJar());
@@ -58,17 +53,18 @@ void LibrariesTask::executeTask()
QStringList failedLocalJarMods;
processArtifactPool(profile->getJarMods(), failedLocalJarMods, inst->jarModsDir());
- if (!failedLocalJarMods.empty() || !failedLocalLibraries.empty())
- {
+ if (!failedLocalJarMods.empty() || !failedLocalLibraries.empty()) {
downloadJob.reset();
QString failed_all = (failedLocalLibraries + failedLocalJarMods).join("\n");
- emitFailed(tr("Some artifacts marked as 'local' are missing their files:\n%1\n\nYou need to either add the files, or removed the packages that require them.\nYou'll have to correct this problem manually.").arg(failed_all));
+ emitFailed(tr("Some artifacts marked as 'local' are missing their files:\n%1\n\nYou need to either add the files, or removed the "
+ "packages that require them.\nYou'll have to correct this problem manually.")
+ .arg(failed_all));
return;
}
connect(downloadJob.get(), &NetJob::succeeded, this, &LibrariesTask::emitSucceeded);
connect(downloadJob.get(), &NetJob::failed, this, &LibrariesTask::jarlibFailed);
- connect(downloadJob.get(), &NetJob::aborted, this, [this]{ emitFailed(tr("Aborted")); });
+ connect(downloadJob.get(), &NetJob::aborted, this, [this] { emitFailed(tr("Aborted")); });
connect(downloadJob.get(), &NetJob::progress, this, &LibrariesTask::progress);
connect(downloadJob.get(), &NetJob::stepProgress, this, &LibrariesTask::propagateStepProgress);
@@ -87,12 +83,9 @@ void LibrariesTask::jarlibFailed(QString reason)
bool LibrariesTask::abort()
{
- if(downloadJob)
- {
+ if (downloadJob) {
return downloadJob->abort();
- }
- else
- {
+ } else {
qWarning() << "Prematurely aborted LibrariesTask";
}
return true;