diff options
Diffstat (limited to 'api/logic/minecraft/ComponentList.cpp')
-rw-r--r-- | api/logic/minecraft/ComponentList.cpp | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/api/logic/minecraft/ComponentList.cpp b/api/logic/minecraft/ComponentList.cpp index dbf6ee08..3fb04255 100644 --- a/api/logic/minecraft/ComponentList.cpp +++ b/api/logic/minecraft/ComponentList.cpp @@ -450,42 +450,30 @@ bool ComponentList::migratePreComponentConfig() intendedVersion = emptyVersion; } auto file = ProfileUtils::parseJsonFile(QFileInfo(jsonFilePath), false); - bool fileChanged = false; - // if uid is missing or incorrect, fix it - if(file->uid != uid) - { - file->uid = uid; - fileChanged = true; - } + // fix uid + file->uid = uid; // if version is missing, add it from the outside. if(file->version.isEmpty()) { file->version = intendedVersion; - fileChanged = true; } // if this is a dependency (LWJGL), mark it also as volatile if(asDependency) { file->m_volatile = true; - fileChanged = true; } // insert requirements if needed if(!req.uid.isEmpty()) { file->requires.insert(req); - fileChanged = true; } // insert conflicts if needed if(!conflict.uid.isEmpty()) { file->conflicts.insert(conflict); - fileChanged = true; - } - if(fileChanged) - { - // FIXME: @QUALITY do not ignore return value - ProfileUtils::saveJsonFile(OneSixVersionFormat::versionFileToJson(file), jsonFilePath); } + // FIXME: @QUALITY do not ignore return value + ProfileUtils::saveJsonFile(OneSixVersionFormat::versionFileToJson(file), jsonFilePath); component = new Component(this, uid, file); component->m_version = intendedVersion; } @@ -538,17 +526,9 @@ bool ComponentList::migratePreComponentConfig() QFile::remove(info.absoluteFilePath()); continue; } - bool fileChanged = false; - if(file->uid != uid) - { - file->uid = uid; - fileChanged = true; - } - if(fileChanged) - { - // FIXME: @QUALITY do not ignore return value - ProfileUtils::saveJsonFile(OneSixVersionFormat::versionFileToJson(file), info.absoluteFilePath()); - } + file->uid = uid; + // FIXME: @QUALITY do not ignore return value + ProfileUtils::saveJsonFile(OneSixVersionFormat::versionFileToJson(file), info.absoluteFilePath()); auto component = new Component(this, file->uid, file); auto version = d->getOldConfigVersion(file->uid); |