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

Method removeComponent_internal

launcher/minecraft/PackProfile.cpp:742–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

740}
741
742bool 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
786bool PackProfile::installJarMods_internal(QStringList filepaths)
787{

Callers

nothing calls this directly

Calls 11

getFilenameMethod · 0.80
errorStringMethod · 0.80
isLocalMethod · 0.80
getApplicableFilesMethod · 0.80
jarmodsPathMethod · 0.80
getVersionFileMethod · 0.80
sizeMethod · 0.45
existsMethod · 0.45
removeMethod · 0.45
nameMethod · 0.45
runtimeContextMethod · 0.45

Tested by

no test coverage detected