summaryrefslogtreecommitdiffstats
path: root/logic/minecraft
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-03-03 01:40:12 +0100
committerPetr Mrázek <peterix@gmail.com>2016-03-03 01:40:12 +0100
commit94d46848095bc75627873708b1d0d5b2632b85db (patch)
treeaaff777681ea6b6fe8107460a011511984b948b5 /logic/minecraft
parentb54839b8976b5c1455c838828f2bc92cdeb178eb (diff)
downloadMultiMC-94d46848095bc75627873708b1d0d5b2632b85db.tar
MultiMC-94d46848095bc75627873708b1d0d5b2632b85db.tar.gz
MultiMC-94d46848095bc75627873708b1d0d5b2632b85db.tar.lz
MultiMC-94d46848095bc75627873708b1d0d5b2632b85db.tar.xz
MultiMC-94d46848095bc75627873708b1d0d5b2632b85db.zip
NOISSUE add basic unit tests for MojangVersionFormat reading/writing
will have to make them pass now
Diffstat (limited to 'logic/minecraft')
-rw-r--r--logic/minecraft/MojangVersionFormat.cpp7
-rw-r--r--logic/minecraft/MojangVersionFormat.h4
-rw-r--r--logic/minecraft/OneSixRule.cpp5
3 files changed, 12 insertions, 4 deletions
diff --git a/logic/minecraft/MojangVersionFormat.cpp b/logic/minecraft/MojangVersionFormat.cpp
index e28a38ab..4d6f205b 100644
--- a/logic/minecraft/MojangVersionFormat.cpp
+++ b/logic/minecraft/MojangVersionFormat.cpp
@@ -63,13 +63,12 @@ VersionFilePtr MojangVersionFormat::versionFileFromJson(const QJsonDocument &doc
if (root.contains("libraries"))
{
- out->shouldOverwriteLibs = true;
for (auto libVal : requireArray(root.value("libraries")))
{
auto libObj = requireObject(libVal);
auto lib = OneSixVersionFormat::libraryFromJson(libObj, filename);
- out->overwriteLibs.append(lib);
+ out->addLibs.append(lib);
}
}
return out;
@@ -86,6 +85,10 @@ static QJsonDocument versionFileToJson(VersionFilePtr patch)
writeString(root, "assets", patch->assets);
writeString(root, "releaseTime", timeToS3Time(patch->m_releaseTime));
writeString(root, "time", timeToS3Time(patch->m_updateTime));
+ if(patch->minimumLauncherVersion != -1)
+ {
+ root.insert("minimumLauncherVersion", patch->minimumLauncherVersion);
+ }
if (!patch->addLibs.isEmpty())
{
diff --git a/logic/minecraft/MojangVersionFormat.h b/logic/minecraft/MojangVersionFormat.h
index 925990ab..cd87d68e 100644
--- a/logic/minecraft/MojangVersionFormat.h
+++ b/logic/minecraft/MojangVersionFormat.h
@@ -3,7 +3,9 @@
#include <minecraft/VersionFile.h>
#include <QJsonDocument>
-class MojangVersionFormat
+#include "multimc_logic_export.h"
+
+class MULTIMC_LOGIC_EXPORT MojangVersionFormat
{
public:
// version files / profile patches
diff --git a/logic/minecraft/OneSixRule.cpp b/logic/minecraft/OneSixRule.cpp
index fc9f8f71..3f4a6bb9 100644
--- a/logic/minecraft/OneSixRule.cpp
+++ b/logic/minecraft/OneSixRule.cpp
@@ -82,7 +82,10 @@ QJsonObject OsRule::toJson()
QJsonObject osObj;
{
osObj.insert("name", OpSys_toString(m_system));
- osObj.insert("version", m_version_regexp);
+ if(!m_version_regexp.isEmpty())
+ {
+ osObj.insert("version", m_version_regexp);
+ }
}
ruleObj.insert("os", osObj);
return ruleObj;