MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / deleteResources

Method deleteResources

launcher/minecraft/mod/ModFolderModel.cpp:488–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488bool ModFolderModel::deleteResources(const QModelIndexList& indexes)
489{
490 auto deleteInvalid = [](QSet<Mod*>& mods) {
491 for (auto it = mods.begin(); it != mods.end();) {
492 auto mod = *it;
493 // the QFileInfo::exists is used instead of mod->fileinfo().exists
494 // because the later somehow caches that the file exists
495 if (!mod || !QFileInfo::exists(mod->fileinfo().absoluteFilePath())) {
496 it = mods.erase(it);
497 } else {
498 ++it;
499 }
500 }
501 };
502 auto rsp = ResourceFolderModel::deleteResources(indexes);
503 for (auto mod : allMods()) {
504 auto id = mod->mod_id();
505 deleteInvalid(m_requiredBy[id]);
506 deleteInvalid(m_requires[id]);
507 if (mod->requiredByCount() != m_requiredBy[id].count() || mod->requiresCount() != m_requires[id].count()) {
508 mod->setRequiredByCount(m_requiredBy[id].count());
509 mod->setRequiresCount(m_requires[id].count());
510 int row = m_resources_index[mod->internal_id()];
511 emit dataChanged(index(row, RequiresColumn), index(row, RequiredByColumn));
512 }
513 }
514 return rsp;
515}

Callers 2

removeItemsMethod · 0.45
removeItemsMethod · 0.45

Calls 8

fileinfoMethod · 0.80
requiredByCountMethod · 0.80
requiresCountMethod · 0.80
setRequiredByCountMethod · 0.80
setRequiresCountMethod · 0.80
internal_idMethod · 0.80
mod_idMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected