From e5b4dee1c05d0d6ebc0d7b2dd802b93cb8765e63 Mon Sep 17 00:00:00 2001 From: Jan Dalheimer Date: Fri, 14 Mar 2014 19:51:56 +0100 Subject: Move version stuff to the model and reimplement reordering --- logic/OneSixVersionBuilder.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'logic/OneSixVersionBuilder.cpp') diff --git a/logic/OneSixVersionBuilder.cpp b/logic/OneSixVersionBuilder.cpp index 8eacbce4..35d01a46 100644 --- a/logic/OneSixVersionBuilder.cpp +++ b/logic/OneSixVersionBuilder.cpp @@ -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); -- cgit