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