diff options
author | OverMighty <its.overmighty@gmail.com> | 2020-05-04 11:36:41 +0200 |
---|---|---|
committer | OverMighty <its.overmighty@gmail.com> | 2020-05-04 11:36:41 +0200 |
commit | 313a6574c15e0cc0fd9bb510609b63905d1c760b (patch) | |
tree | 02d108881481f76c6c1dd6faab0cc2b844fcf8de /api/logic/minecraft/OneSixVersionFormat.cpp | |
parent | 381c12547fe91a7392f42337674da390841b39ed (diff) | |
parent | 5ca5661c23050d738f1d5f9ced5e7fb71eef3fce (diff) | |
download | MultiMC-313a6574c15e0cc0fd9bb510609b63905d1c760b.tar MultiMC-313a6574c15e0cc0fd9bb510609b63905d1c760b.tar.gz MultiMC-313a6574c15e0cc0fd9bb510609b63905d1c760b.tar.lz MultiMC-313a6574c15e0cc0fd9bb510609b63905d1c760b.tar.xz MultiMC-313a6574c15e0cc0fd9bb510609b63905d1c760b.zip |
chore: pull changes from upstream
Diffstat (limited to 'api/logic/minecraft/OneSixVersionFormat.cpp')
-rw-r--r-- | api/logic/minecraft/OneSixVersionFormat.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/api/logic/minecraft/OneSixVersionFormat.cpp b/api/logic/minecraft/OneSixVersionFormat.cpp index 6f3b926b..a0b6fd0e 100644 --- a/api/logic/minecraft/OneSixVersionFormat.cpp +++ b/api/logic/minecraft/OneSixVersionFormat.cpp @@ -144,14 +144,14 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc } } - auto readLibs = [&](const char * which) + auto readLibs = [&](const char * which, QList<LibraryPtr> & out) { for (auto libVal : requireArray(root.value(which))) { QJsonObject libObj = requireObject(libVal); // parse the library auto lib = libraryFromJson(libObj, filename); - out->libraries.append(lib); + out.append(lib); } }; bool hasPlusLibs = root.contains("+libraries"); @@ -160,16 +160,20 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc { out->addProblem(ProblemSeverity::Warning, QObject::tr("Version file has both '+libraries' and 'libraries'. This is no longer supported.")); - readLibs("libraries"); - readLibs("+libraries"); + readLibs("libraries", out->libraries); + readLibs("+libraries", out->libraries); } else if (hasLibs) { - readLibs("libraries"); + readLibs("libraries", out->libraries); } else if(hasPlusLibs) { - readLibs("+libraries"); + readLibs("+libraries", out->libraries); + } + + if(root.contains("mavenFiles")) { + readLibs("mavenFiles", out->mavenFiles); } // if we have mainJar, just use it @@ -276,6 +280,15 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch } root.insert("libraries", array); } + if (!patch->mavenFiles.isEmpty()) + { + QJsonArray array; + for (auto value: patch->mavenFiles) + { + array.append(OneSixVersionFormat::libraryToJson(value.get())); + } + root.insert("mavenFiles", array); + } if (!patch->jarMods.isEmpty()) { QJsonArray array; |