NOISSUE 'required' attribute of curse manifests is optional, libraries attribute reading

This commit is contained in:
Petr Mrázek 2017-04-22 00:29:24 +02:00
parent 1d71214d4a
commit 6a525db78d
2 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,8 @@ static void loadFileV1(Curse::File & f, QJsonObject & file)
{
f.projectId = Json::requireInteger(file, "projectID");
f.fileId = Json::requireInteger(file, "fileID");
f.required = Json::requireBoolean(file, "required");
// FIXME: what does this mean?
f.required = Json::ensureBoolean(file, QString("required"), true);
}
static void loadModloaderV1(Curse::Modloader & m, QJsonObject & modLoader)
@ -17,6 +18,8 @@ static void loadModloaderV1(Curse::Modloader & m, QJsonObject & modLoader)
static void loadMinecraftV1(Curse::Minecraft & m, QJsonObject & minecraft)
{
m.version = Json::requireString(minecraft, "version");
// FIXME: default unknown, assuming empty. Meaning also unknown.
m.libraries = Json::ensureString(minecraft, QString("libraries"), QString());
auto arr = Json::ensureArray(minecraft, "modLoaders", QJsonArray());
for (const auto & item : arr)
{

View File

@ -26,6 +26,7 @@ struct Modloader
struct Minecraft
{
QString version;
QString libraries;
QVector<Curse::Modloader> modLoaders;
};