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

Method flameCallback

launcher/modplatform/EnsureMetadataTask.cpp:512–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512void EnsureMetadataTask::flameCallback(ModPlatform::IndexedPack& pack, ModPlatform::IndexedVersion& ver, Mod* mod)
513{
514 try {
515 // Prevent file name mismatch
516 ver.fileName = mod->fileinfo().fileName();
517 if (ver.fileName.endsWith(".disabled"))
518 ver.fileName.chop(9);
519
520 QDir tmp_index_dir(m_index_dir);
521
522 {
523 LocalModUpdateTask update_metadata(m_index_dir, pack, ver);
524 QEventLoop loop;
525
526 QObject::connect(&update_metadata, &Task::finished, &loop, &QEventLoop::quit);
527
528 update_metadata.start();
529
530 if (!update_metadata.isFinished())
531 loop.exec();
532 }
533
534 auto metadata = Metadata::get(tmp_index_dir, pack.slug);
535 if (!metadata.isValid()) {
536 qCritical() << "Failed to generate metadata at last step!";
537 emitFail(mod);
538 return;
539 }
540
541 mod->setMetadata(metadata);
542
543 emitReady(mod);
544 } catch (Json::JsonException& e) {
545 qDebug() << e.cause();
546
547 emitFail(mod);
548 }
549}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected