diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2014-01-27 22:23:07 +0100 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2014-01-27 22:23:07 +0100 |
commit | 986141b5035c99747c7e06cd447b8b4e27eb2b27 (patch) | |
tree | 3de534a0192bb62d4654342bf0d89b7e46d41cae /logic | |
parent | 176783c8caacafd5d320c2fef7374335ee54796b (diff) | |
download | MultiMC-986141b5035c99747c7e06cd447b8b4e27eb2b27.tar MultiMC-986141b5035c99747c7e06cd447b8b4e27eb2b27.tar.gz MultiMC-986141b5035c99747c7e06cd447b8b4e27eb2b27.tar.lz MultiMC-986141b5035c99747c7e06cd447b8b4e27eb2b27.tar.xz MultiMC-986141b5035c99747c7e06cd447b8b4e27eb2b27.zip |
Fix library ordering
Diffstat (limited to 'logic')
-rw-r--r-- | logic/ForgeInstaller.cpp | 8 | ||||
-rw-r--r-- | logic/LiteLoaderInstaller.cpp | 2 | ||||
-rw-r--r-- | logic/OneSixVersionBuilder.cpp | 36 |
3 files changed, 17 insertions, 29 deletions
diff --git a/logic/ForgeInstaller.cpp b/logic/ForgeInstaller.cpp index c0340e95..8d2445ed 100644 --- a/logic/ForgeInstaller.cpp +++ b/logic/ForgeInstaller.cpp @@ -160,7 +160,7 @@ bool ForgeInstaller::add(OneSixInstance *to) equals = true; } // replace lib - libObj.insert("insert", QString("apply")); + libObj.insert("insert", QString("replace")); break; } if (equals) @@ -170,11 +170,7 @@ bool ForgeInstaller::add(OneSixInstance *to) if (!found) { // add lib - QJsonObject insertObj; - insertObj.insert( - "before", - to->getFullVersion()->libraries.at(sliding_insert_window + 1)->rawName()); - libObj.insert("insert", insertObj); + libObj.insert("insert", QString("prepend-if-not-exists")); sliding_insert_window++; } librariesPlus.prepend(libObj); diff --git a/logic/LiteLoaderInstaller.cpp b/logic/LiteLoaderInstaller.cpp index 1c38fd5e..f658f834 100644 --- a/logic/LiteLoaderInstaller.cpp +++ b/logic/LiteLoaderInstaller.cpp @@ -63,7 +63,7 @@ bool LiteLoaderInstaller::add(OneSixInstance *to) OneSixLibrary launchwrapperLib("net.minecraft:launchwrapper:" + m_launcherWrapperVersionMapping[to->intendedVersionId()]); launchwrapperLib.finalize(); QJsonObject lwLibObj = launchwrapperLib.toJson(); - lwLibObj.insert("insert", QString("prepend")); + lwLibObj.insert("insert", QString("prepend-if-not-exists")); libraries.append(lwLibObj); } diff --git a/logic/OneSixVersionBuilder.cpp b/logic/OneSixVersionBuilder.cpp index c031a94a..3b119b45 100644 --- a/logic/OneSixVersionBuilder.cpp +++ b/logic/OneSixVersionBuilder.cpp @@ -70,8 +70,8 @@ struct VersionFile Apply, Append, Prepend, - InsertBefore, - InsertAfter, + AppendIfNotExists, + PrependIfNotExists, Replace }; InsertType insertType; @@ -408,13 +408,13 @@ struct VersionFile { lib.insertType = Library::Prepend; } - else if (insertString == "before") + else if (insertString == "prepend-if-not-exists") { - lib.insertType = Library::InsertBefore; + lib.insertType = Library::PrependIfNotExists; } - else if (insertString == "after") + else if (insertString == "append-if-not-exists") { - lib.insertType = Library::InsertAfter; + lib.insertType = Library::PrependIfNotExists; } else if (insertString == "replace") { @@ -613,31 +613,23 @@ struct VersionFile case Library::Prepend: version->libraries.prepend(createLibrary(lib)); break; - case Library::InsertBefore: + case Library::AppendIfNotExists: { - int index = findLibrary(version->libraries, lib.insertData); - if (index >= 0) - { - version->libraries.insert(index, createLibrary(lib)); - } - else + int index = findLibrary(version->libraries, lib.name); + if (index < 0) { - QLOG_WARN() << "Couldn't find" << lib.insertData << "(skipping)"; + version->libraries.append(createLibrary(lib)); } break; } - case Library::InsertAfter: + case Library::PrependIfNotExists: { - int index = findLibrary(version->libraries, lib.insertData); - if (index >= 0) - { - version->libraries.insert(index + 1, createLibrary(lib)); - } - else + int index = findLibrary(version->libraries, lib.name); + if (index < 0) { - QLOG_WARN() << "Couldn't find" << lib.insertData << "(skipping)"; + version->libraries.prepend(createLibrary(lib)); } break; } |