| 740 | } |
| 741 | |
| 742 | bool PackProfile::removeComponent_internal(ComponentPtr patch) |
| 743 | { |
| 744 | bool ok = true; |
| 745 | // first, remove the patch file. this ensures it's not used anymore |
| 746 | auto fileName = patch->getFilename(); |
| 747 | if (fileName.size()) { |
| 748 | QFile patchFile(fileName); |
| 749 | if (patchFile.exists() && !patchFile.remove()) { |
| 750 | qCCritical(instanceProfileC) << d->m_instance->name() << "|" << "File" << fileName |
| 751 | << "could not be removed because:" << patchFile.errorString(); |
| 752 | return false; |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | // FIXME: we need a generic way of removing local resources, not just jar mods... |
| 757 | auto preRemoveJarMod = [this](LibraryPtr jarMod) -> bool { |
| 758 | if (!jarMod->isLocal()) { |
| 759 | return true; |
| 760 | } |
| 761 | QStringList jar, temp1, temp2, temp3; |
| 762 | jarMod->getApplicableFiles(d->m_instance->runtimeContext(), jar, temp1, temp2, temp3, d->m_instance->jarmodsPath().absolutePath()); |
| 763 | QFileInfo finfo(jar[0]); |
| 764 | if (finfo.exists()) { |
| 765 | QFile jarModFile(jar[0]); |
| 766 | if (!jarModFile.remove()) { |
| 767 | qCCritical(instanceProfileC) << d->m_instance->name() << "|" << "File" << jar[0] |
| 768 | << "could not be removed because:" << jarModFile.errorString(); |
| 769 | return false; |
| 770 | } |
| 771 | return true; |
| 772 | } |
| 773 | return true; |
| 774 | }; |
| 775 | |
| 776 | auto vFile = patch->getVersionFile(); |
| 777 | if (vFile) { |
| 778 | auto& jarMods = vFile->jarMods; |
| 779 | for (auto& jarmod : jarMods) { |
| 780 | ok &= preRemoveJarMod(jarmod); |
| 781 | } |
| 782 | } |
| 783 | return ok; |
| 784 | } |
| 785 | |
| 786 | bool PackProfile::installJarMods_internal(QStringList filepaths) |
| 787 | { |
nothing calls this directly
no test coverage detected