Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into lambda
This commit is contained in:
commit
0e80aae1b8
69 changed files with 1868 additions and 1376 deletions
|
@ -243,7 +243,8 @@ bool ModrinthCreationTask::createInstance()
|
|||
|
||||
auto root_modpack_path = FS::PathCombine(m_stagingPath, m_root_path);
|
||||
auto root_modpack_url = QUrl::fromLocalFile(root_modpack_path);
|
||||
QHash<QString, Mod*> mods;
|
||||
// TODO make this work with other sorts of resource
|
||||
QHash<QString, Resource*> resources;
|
||||
for (auto file : m_files) {
|
||||
auto fileName = file.path;
|
||||
fileName = FS::RemoveInvalidPathChars(fileName);
|
||||
|
@ -259,7 +260,7 @@ bool ModrinthCreationTask::createInstance()
|
|||
ModDetails d;
|
||||
d.mod_id = file_path;
|
||||
mod->setDetails(d);
|
||||
mods[file.hash.toHex()] = mod;
|
||||
resources[file.hash.toHex()] = mod;
|
||||
}
|
||||
|
||||
qDebug() << "Will try to download" << file.downloads.front() << "to" << file_path;
|
||||
|
@ -302,15 +303,15 @@ bool ModrinthCreationTask::createInstance()
|
|||
loop.exec();
|
||||
|
||||
if (!ended_well) {
|
||||
for (auto m : mods) {
|
||||
delete m;
|
||||
for (auto resource : resources) {
|
||||
delete resource;
|
||||
}
|
||||
return ended_well;
|
||||
}
|
||||
|
||||
QEventLoop ensureMetaLoop;
|
||||
QDir folder = FS::PathCombine(instance.modsRoot(), ".index");
|
||||
auto ensureMetadataTask = makeShared<EnsureMetadataTask>(mods, folder, ModPlatform::ResourceProvider::MODRINTH);
|
||||
auto ensureMetadataTask = makeShared<EnsureMetadataTask>(resources, folder, ModPlatform::ResourceProvider::MODRINTH);
|
||||
connect(ensureMetadataTask.get(), &Task::succeeded, this, [&ended_well]() { ended_well = true; });
|
||||
connect(ensureMetadataTask.get(), &Task::finished, &ensureMetaLoop, &QEventLoop::quit);
|
||||
connect(ensureMetadataTask.get(), &Task::progress, [this](qint64 current, qint64 total) {
|
||||
|
@ -323,10 +324,10 @@ bool ModrinthCreationTask::createInstance()
|
|||
m_task = ensureMetadataTask;
|
||||
|
||||
ensureMetaLoop.exec();
|
||||
for (auto m : mods) {
|
||||
delete m;
|
||||
for (auto resource : resources) {
|
||||
delete resource;
|
||||
}
|
||||
mods.clear();
|
||||
resources.clear();
|
||||
|
||||
// Update information of the already installed instance, if any.
|
||||
if (m_instance && ended_well) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue