GH-2478 fix jarmods being detected as missing
This commit is contained in:
parent
9eb456336d
commit
0ee915200b
@ -169,6 +169,12 @@ QString MinecraftInstance::getLocalLibraryPath() const
|
|||||||
return libraries_dir.absolutePath();
|
return libraries_dir.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MinecraftInstance::jarModsDir() const
|
||||||
|
{
|
||||||
|
QDir jarmods_dir(FS::PathCombine(instanceRoot(), "jarmods/"));
|
||||||
|
return jarmods_dir.absolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
QString MinecraftInstance::loaderModsDir() const
|
QString MinecraftInstance::loaderModsDir() const
|
||||||
{
|
{
|
||||||
return FS::PathCombine(gameRoot(), "mods");
|
return FS::PathCombine(gameRoot(), "mods");
|
||||||
@ -199,11 +205,6 @@ QString MinecraftInstance::instanceConfigFolder() const
|
|||||||
return FS::PathCombine(gameRoot(), "config");
|
return FS::PathCombine(gameRoot(), "config");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MinecraftInstance::jarModsDir() const
|
|
||||||
{
|
|
||||||
return FS::PathCombine(instanceRoot(), "jarmods");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MinecraftInstance::libDir() const
|
QString MinecraftInstance::libDir() const
|
||||||
{
|
{
|
||||||
return FS::PathCombine(gameRoot(), "lib");
|
return FS::PathCombine(gameRoot(), "lib");
|
||||||
|
@ -22,34 +22,44 @@ void LibrariesTask::executeTask()
|
|||||||
downloadJob.reset(job);
|
downloadJob.reset(job);
|
||||||
|
|
||||||
auto metacache = ENV.metacache();
|
auto metacache = ENV.metacache();
|
||||||
QStringList failedLocalFiles;
|
|
||||||
|
|
||||||
QList<LibraryPtr> artifactPool;
|
auto processArtifactPool = [&](const QList<LibraryPtr> & pool, QStringList & errors, const QString & localPath)
|
||||||
artifactPool.append(profile->getLibraries());
|
|
||||||
artifactPool.append(profile->getNativeLibraries());
|
|
||||||
artifactPool.append(profile->getJarMods());
|
|
||||||
artifactPool.append(profile->getMainJar());
|
|
||||||
for (auto lib : artifactPool)
|
|
||||||
{
|
{
|
||||||
if(!lib)
|
for (auto lib : pool)
|
||||||
{
|
{
|
||||||
emitFailed(tr("Null jar is specified in the metadata, aborting."));
|
if(!lib)
|
||||||
return;
|
{
|
||||||
|
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());
|
return true;
|
||||||
for(auto dl : dls)
|
};
|
||||||
{
|
|
||||||
downloadJob->addNetAction(dl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
downloadJob.reset();
|
||||||
QString failed_all = failedLocalFiles.join("\n");
|
QString failed_all = (failedLocalLibraries + failedLocalJarMods).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));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(downloadJob.get(), &NetJob::succeeded, this, &LibrariesTask::emitSucceeded);
|
connect(downloadJob.get(), &NetJob::succeeded, this, &LibrariesTask::emitSucceeded);
|
||||||
connect(downloadJob.get(), &NetJob::failed, this, &LibrariesTask::jarlibFailed);
|
connect(downloadJob.get(), &NetJob::failed, this, &LibrariesTask::jarlibFailed);
|
||||||
connect(downloadJob.get(), &NetJob::progress, this, &LibrariesTask::progress);
|
connect(downloadJob.get(), &NetJob::progress, this, &LibrariesTask::progress);
|
||||||
|
Loading…
Reference in New Issue
Block a user