| 740 | } |
| 741 | |
| 742 | bool PackProfile::installEmpty(const QString& uid, const QString& name) |
| 743 | { |
| 744 | QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches"); |
| 745 | if(!FS::ensureFolderPathExists(patchDir)) |
| 746 | { |
| 747 | return false; |
| 748 | } |
| 749 | auto f = std::make_shared<VersionFile>(); |
| 750 | f->name = name; |
| 751 | f->uid = uid; |
| 752 | f->version = "1"; |
| 753 | QString patchFileName = FS::PathCombine(patchDir, uid + ".json"); |
| 754 | QFile file(patchFileName); |
| 755 | if (!file.open(QFile::WriteOnly)) |
| 756 | { |
| 757 | qCritical() << "Error opening" << file.fileName() |
| 758 | << "for reading:" << file.errorString(); |
| 759 | return false; |
| 760 | } |
| 761 | file.write(OneSixVersionFormat::versionFileToJson(f).toJson()); |
| 762 | file.close(); |
| 763 | |
| 764 | appendComponent(new Component(this, f->uid, f)); |
| 765 | scheduleSave(); |
| 766 | invalidateLaunchProfile(); |
| 767 | return true; |
| 768 | } |
| 769 | |
| 770 | bool PackProfile::removeComponent_internal(ComponentPtr patch) |
| 771 | { |
no test coverage detected