mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-03 11:56:57 +03:00
NOISSUE add versioning to component metadata format and use it
This commit is contained in:
parent
50ca6cbb4d
commit
719f3e863a
10 changed files with 94 additions and 136 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue