summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/ComponentList.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-12-29 00:37:14 +0100
committerPetr Mrázek <peterix@gmail.com>2017-12-29 00:37:14 +0100
commit719f3e863a2bdbaeaba37e837e0f6b75de124e6c (patch)
treebff005dd7e36b08d355bfec58742d44265fc0dd6 /api/logic/minecraft/ComponentList.cpp
parent50ca6cbb4daaa4acd300defc6b7ecc7ccb46cebf (diff)
downloadMultiMC-719f3e863a2bdbaeaba37e837e0f6b75de124e6c.tar
MultiMC-719f3e863a2bdbaeaba37e837e0f6b75de124e6c.tar.gz
MultiMC-719f3e863a2bdbaeaba37e837e0f6b75de124e6c.tar.lz
MultiMC-719f3e863a2bdbaeaba37e837e0f6b75de124e6c.tar.xz
MultiMC-719f3e863a2bdbaeaba37e837e0f6b75de124e6c.zip
NOISSUE add versioning to component metadata format and use it
Diffstat (limited to 'api/logic/minecraft/ComponentList.cpp')
-rw-r--r--api/logic/minecraft/ComponentList.cpp34
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);