| 947 | } |
| 948 | |
| 949 | bool PackProfile::installEmpty(const QString& uid, const QString& name) |
| 950 | { |
| 951 | QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches"); |
| 952 | if(!FS::ensureFolderPathExists(patchDir)) |
| 953 | { |
| 954 | return false; |
| 955 | } |
| 956 | auto f = std::make_shared<VersionFile>(); |
| 957 | f->name = name; |
| 958 | f->uid = uid; |
| 959 | f->version = "1"; |
| 960 | QString patchFileName = FS::PathCombine(patchDir, uid + ".json"); |
| 961 | QFile file(patchFileName); |
| 962 | if (!file.open(QFile::WriteOnly)) |
| 963 | { |
| 964 | qCritical() << "Error opening" << file.fileName() |
| 965 | << "for reading:" << file.errorString(); |
| 966 | return false; |
| 967 | } |
| 968 | file.write(OneSixVersionFormat::versionFileToJson(f).toJson()); |
| 969 | file.close(); |
| 970 | |
| 971 | appendComponent(new Component(this, f->uid, f)); |
| 972 | scheduleSave(); |
| 973 | invalidateLaunchProfile(); |
| 974 | return true; |
| 975 | } |
| 976 | |
| 977 | bool PackProfile::removeComponent_internal(ComponentPtr patch) |
| 978 | { |
no test coverage detected