mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-22 11:39:55 +00:00
Move version stuff to the model and reimplement reordering
This commit is contained in:
@@ -58,13 +58,15 @@ void OneSixVersionBuilder::readJsonAndApplyToVersion(VersionFinal *version,
|
||||
|
||||
void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringList &external)
|
||||
{
|
||||
m_version->clear();
|
||||
m_version->versionFiles.clear();
|
||||
|
||||
QDir root(m_instance->instanceRoot());
|
||||
QDir patches(root.absoluteFilePath("patches/"));
|
||||
|
||||
// if we do external files, do just those.
|
||||
if (!external.isEmpty())
|
||||
{
|
||||
int externalOrder = -1;
|
||||
for (auto fileName : external)
|
||||
{
|
||||
QLOG_INFO() << "Reading" << fileName;
|
||||
@@ -72,11 +74,12 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi
|
||||
parseJsonFile(QFileInfo(fileName), false, fileName.endsWith("pack.json"));
|
||||
file->name = QFileInfo(fileName).fileName();
|
||||
file->fileId = "org.multimc.external." + file->name;
|
||||
file->order = (externalOrder += 1);
|
||||
file->version = QString();
|
||||
file->mcVersion = QString();
|
||||
file->applyTo(m_version);
|
||||
m_version->versionFiles.append(file);
|
||||
}
|
||||
}
|
||||
// else, if there's custom json, we just do that.
|
||||
else if (QFile::exists(root.absoluteFilePath("custom.json")))
|
||||
{
|
||||
@@ -85,8 +88,8 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi
|
||||
file->name = "custom.json";
|
||||
file->filename = "custom.json";
|
||||
file->fileId = "org.multimc.custom.json";
|
||||
file->order = -1;
|
||||
file->version = QString();
|
||||
file->applyTo(m_version);
|
||||
m_version->versionFiles.append(file);
|
||||
// QObject::tr("The version descriptors of this instance are not compatible with the
|
||||
// current version of MultiMC"));
|
||||
@@ -101,9 +104,9 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi
|
||||
auto file = parseJsonFile(QFileInfo(root.absoluteFilePath("version.json")), false);
|
||||
file->name = "Minecraft";
|
||||
file->fileId = "org.multimc.version.json";
|
||||
file->order = -1;
|
||||
file->version = m_instance->intendedVersionId();
|
||||
file->mcVersion = m_instance->intendedVersionId();
|
||||
file->applyTo(m_version);
|
||||
m_version->versionFiles.append(file);
|
||||
// QObject::tr("Error while applying %1. Please check MultiMC-0.log for more
|
||||
// info.").arg(root.absoluteFilePath("version.json")));
|
||||
@@ -128,9 +131,7 @@ void OneSixVersionBuilder::buildInternal(const bool onlyVanilla, const QStringLi
|
||||
}
|
||||
for (auto order : files.keys())
|
||||
{
|
||||
QLOG_DEBUG() << "Applying file with order" << order;
|
||||
auto &filePair = files[order];
|
||||
filePair.second->applyTo(m_version);
|
||||
m_version->versionFiles.append(filePair.second);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
Reference in New Issue
Block a user