MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / modrinthCallback

Method modrinthCallback

launcher/modplatform/EnsureMetadataTask.cpp:479–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479void EnsureMetadataTask::modrinthCallback(ModPlatform::IndexedPack& pack, ModPlatform::IndexedVersion& ver, Mod* mod)
480{
481 // Prevent file name mismatch
482 ver.fileName = mod->fileinfo().fileName();
483 if (ver.fileName.endsWith(".disabled"))
484 ver.fileName.chop(9);
485
486 QDir tmp_index_dir(m_index_dir);
487
488 {
489 LocalModUpdateTask update_metadata(m_index_dir, pack, ver);
490 QEventLoop loop;
491
492 QObject::connect(&update_metadata, &Task::finished, &loop, &QEventLoop::quit);
493
494 update_metadata.start();
495
496 if (!update_metadata.isFinished())
497 loop.exec();
498 }
499
500 auto metadata = Metadata::get(tmp_index_dir, pack.slug);
501 if (!metadata.isValid()) {
502 qCritical() << "Failed to generate metadata at last step!";
503 emitFail(mod);
504 return;
505 }
506
507 mod->setMetadata(metadata);
508
509 emitReady(mod);
510}
511
512void EnsureMetadataTask::flameCallback(ModPlatform::IndexedPack& pack, ModPlatform::IndexedVersion& ver, Mod* mod)
513{

Callers

nothing calls this directly

Calls 6

fileinfoMethod · 0.80
isFinishedMethod · 0.80
startMethod · 0.45
execMethod · 0.45
isValidMethod · 0.45
setMetadataMethod · 0.45

Tested by

no test coverage detected