| 677 | } |
| 678 | |
| 679 | bool 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 | |
| 708 | void PackProfile::installAgents(QStringList selectedFiles) |
| 709 | { |
no test coverage detected