custom.json overrides all. For user patching there now is instance.json

This commit is contained in:
Jan Dalheimer 2014-01-28 07:39:43 +01:00
parent 986141b503
commit 556d8f0ec1

View File

@ -695,7 +695,29 @@ bool OneSixVersionBuilder::build(const bool excludeCustom)
QDir root(m_instance->instanceRoot());
QDir patches(root.absoluteFilePath("patches/"));
// version.json -> patches/*.json -> custom.json
if (QFile::exists(root.absoluteFilePath("custom.json")))
{
QLOG_INFO() << "Reading custom.json";
VersionFile file;
if (!read(QFileInfo(root.absoluteFilePath("custom.json")), false, &file))
{
return false;
}
bool isError = false;
file.applyTo(m_version, isError);
if (isError)
{
QMessageBox::critical(
m_widgetParent, QObject::tr("Error"),
QObject::tr(
"Error while applying %1. Please check MultiMC-0.log for more info.")
.arg(root.absoluteFilePath("custom.json")));
return false;
}
}
else
{
// version.json -> patches/*.json -> instance.json
// version.json
{
@ -751,14 +773,14 @@ bool OneSixVersionBuilder::build(const bool excludeCustom)
}
}
// custom.json
// instance.json
if (!excludeCustom)
{
if (QFile::exists(root.absoluteFilePath("custom.json")))
if (QFile::exists(root.absoluteFilePath("instance.json")))
{
QLOG_INFO() << "Reading custom.json";
QLOG_INFO() << "Reading instance.json";
VersionFile file;
if (!read(QFileInfo(root.absoluteFilePath("custom.json")), false, &file))
if (!read(QFileInfo(root.absoluteFilePath("instance.json")), false, &file))
{
return false;
}
@ -770,11 +792,12 @@ bool OneSixVersionBuilder::build(const bool excludeCustom)
m_widgetParent, QObject::tr("Error"),
QObject::tr(
"Error while applying %1. Please check MultiMC-0.log for more info.")
.arg(root.absoluteFilePath("custom.json")));
.arg(root.absoluteFilePath("instance.json")));
return false;
}
}
}
}
// some final touches
{