summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/logic/minecraft/MinecraftInstance.cpp11
-rw-r--r--api/logic/minecraft/update/LibrariesTask.cpp48
2 files changed, 35 insertions, 24 deletions
diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp
index f649a744..fecb951a 100644
--- a/api/logic/minecraft/MinecraftInstance.cpp
+++ b/api/logic/minecraft/MinecraftInstance.cpp
@@ -169,6 +169,12 @@ QString MinecraftInstance::getLocalLibraryPath() const
return libraries_dir.absolutePath();
}
+QString MinecraftInstance::jarModsDir() const
+{
+ QDir jarmods_dir(FS::PathCombine(instanceRoot(), "jarmods/"));
+ return jarmods_dir.absolutePath();
+}
+
QString MinecraftInstance::loaderModsDir() const
{
return FS::PathCombine(gameRoot(), "mods");
@@ -199,11 +205,6 @@ QString MinecraftInstance::instanceConfigFolder() const
return FS::PathCombine(gameRoot(), "config");
}
-QString MinecraftInstance::jarModsDir() const
-{
- return FS::PathCombine(instanceRoot(), "jarmods");
-}
-
QString MinecraftInstance::libDir() const
{
return FS::PathCombine(gameRoot(), "lib");
diff --git a/api/logic/minecraft/update/LibrariesTask.cpp b/api/logic/minecraft/update/LibrariesTask.cpp
index 56fa1fc4..7a0a0a6d 100644
--- a/api/logic/minecraft/update/LibrariesTask.cpp
+++ b/api/logic/minecraft/update/LibrariesTask.cpp
@@ -22,34 +22,44 @@ void LibrariesTask::executeTask()
downloadJob.reset(job);
auto metacache = ENV.metacache();
- QStringList failedLocalFiles;
- QList<LibraryPtr> artifactPool;
- artifactPool.append(profile->getLibraries());
- artifactPool.append(profile->getNativeLibraries());
- artifactPool.append(profile->getJarMods());
- artifactPool.append(profile->getMainJar());
- for (auto lib : artifactPool)
+ auto processArtifactPool = [&](const QList<LibraryPtr> & pool, QStringList & errors, const QString & localPath)
{
- if(!lib)
+ for (auto lib : pool)
{
- emitFailed(tr("Null jar is specified in the metadata, aborting."));
- return;
+ if(!lib)
+ {
+ emitFailed(tr("Null jar is specified in the metadata, aborting."));
+ return false;
+ }
+ auto dls = lib->getDownloads(currentSystem, metacache.get(), errors, localPath);
+ for(auto dl : dls)
+ {
+ downloadJob->addNetAction(dl);
+ }
}
- auto dls = lib->getDownloads(currentSystem, metacache.get(), failedLocalFiles, inst->getLocalLibraryPath());
- for(auto dl : dls)
- {
- downloadJob->addNetAction(dl);
- }
- }
+ return true;
+ };
- if (!failedLocalFiles.empty())
+ QStringList failedLocalLibraries;
+ QList<LibraryPtr> libArtifactPool;
+ libArtifactPool.append(profile->getLibraries());
+ libArtifactPool.append(profile->getNativeLibraries());
+ libArtifactPool.append(profile->getMainJar());
+ processArtifactPool(libArtifactPool, failedLocalLibraries, inst->getLocalLibraryPath());
+
+ QStringList failedLocalJarMods;
+ QList<LibraryPtr> jarmodArtifactPool = profile->getJarMods();
+ processArtifactPool(libArtifactPool, failedLocalJarMods, inst->jarModsDir());
+
+ if (!failedLocalJarMods.empty() || !failedLocalLibraries.empty())
{
downloadJob.reset();
- QString failed_all = failedLocalFiles.join("\n");
- emitFailed(tr("Some libraries marked as 'local' are missing their jar files:\n%1\n\nYou'll have to correct this problem manually.").arg(failed_all));
+ 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 requires 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::progress, this, &LibrariesTask::progress);