MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / installComponents

Method installComponents

launcher/minecraft/PackProfile.cpp:679–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677}
678
679bool PackProfile::installComponents(QStringList selectedFiles)
680{
681 const QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches");
682 if (!FS::ensureFolderPathExists(patchDir))
683 return false;
684
685 bool result = true;
686 for (const QString& source : selectedFiles) {
687 const QFileInfo sourceInfo(source);
688
689 auto versionFile = ProfileUtils::parseJsonFile(sourceInfo, false);
690 const QString target = FS::PathCombine(patchDir, versionFile->uid + ".json");
691
692 if (!QFile::copy(source, target)) {
693 qCWarning(instanceProfileC) << d->m_instance->name() << "|" << "Component" << source << "could not be copied to target"
694 << target;
695 result = false;
696 continue;
697 }
698
699 appendComponent(makeShared<Component>(this, versionFile->uid, versionFile));
700 }
701
702 scheduleSave();
703 invalidateLaunchProfile();
704
705 return result;
706}
707
708void PackProfile::installAgents(QStringList selectedFiles)
709{

Calls 6

PathCombineFunction · 0.85
ensureFolderPathExistsFunction · 0.85
parseJsonFileFunction · 0.85
copyClass · 0.85
instanceRootMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected