| 510 | } |
| 511 | |
| 512 | void 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 | } |
nothing calls this directly
no test coverage detected