Different error message if it's a launcher version mismatch
This commit is contained in:
parent
8d0ff99089
commit
4e8be668cb
@ -97,6 +97,13 @@ struct VersionFile
|
|||||||
QList<Library> addLibs;
|
QList<Library> addLibs;
|
||||||
QList<QString> removeLibs;
|
QList<QString> removeLibs;
|
||||||
|
|
||||||
|
enum ApplyError
|
||||||
|
{
|
||||||
|
LauncherVersionError,
|
||||||
|
OtherError,
|
||||||
|
NoApplyError
|
||||||
|
};
|
||||||
|
|
||||||
static Library fromLibraryJson(const QJsonObject &libObj, const QString &filename,
|
static Library fromLibraryJson(const QJsonObject &libObj, const QString &filename,
|
||||||
bool &isError)
|
bool &isError)
|
||||||
{
|
{
|
||||||
@ -537,10 +544,8 @@ struct VersionFile
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
void applyTo(OneSixVersion *version, bool &isError)
|
ApplyError applyTo(OneSixVersion *version)
|
||||||
{
|
{
|
||||||
isError = true;
|
|
||||||
|
|
||||||
if (minimumLauncherVersion != -1)
|
if (minimumLauncherVersion != -1)
|
||||||
{
|
{
|
||||||
if (minimumLauncherVersion > CURRENT_MINIMUM_LAUNCHER_VERSION)
|
if (minimumLauncherVersion > CURRENT_MINIMUM_LAUNCHER_VERSION)
|
||||||
@ -548,7 +553,7 @@ struct VersionFile
|
|||||||
QLOG_ERROR() << filename << "is for a different launcher version ("
|
QLOG_ERROR() << filename << "is for a different launcher version ("
|
||||||
<< minimumLauncherVersion << "), current supported is"
|
<< minimumLauncherVersion << "), current supported is"
|
||||||
<< CURRENT_MINIMUM_LAUNCHER_VERSION;
|
<< CURRENT_MINIMUM_LAUNCHER_VERSION;
|
||||||
return;
|
return LauncherVersionError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,7 +563,7 @@ struct VersionFile
|
|||||||
.indexIn(version->id) == -1)
|
.indexIn(version->id) == -1)
|
||||||
{
|
{
|
||||||
QLOG_ERROR() << filename << "is for a different version of Minecraft";
|
QLOG_ERROR() << filename << "is for a different version of Minecraft";
|
||||||
return;
|
return OtherError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,7 +714,7 @@ struct VersionFile
|
|||||||
QLOG_ERROR() << "Error resolving library dependencies between"
|
QLOG_ERROR() << "Error resolving library dependencies between"
|
||||||
<< otherLib->rawName() << "and" << lib.name << "in"
|
<< otherLib->rawName() << "and" << lib.name << "in"
|
||||||
<< filename;
|
<< filename;
|
||||||
return;
|
return OtherError;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -737,7 +742,7 @@ struct VersionFile
|
|||||||
QLOG_ERROR() << "Error resolving library dependencies between"
|
QLOG_ERROR() << "Error resolving library dependencies between"
|
||||||
<< otherLib->rawName() << "and" << lib.name << "in"
|
<< otherLib->rawName() << "and" << lib.name << "in"
|
||||||
<< filename;
|
<< filename;
|
||||||
return;
|
return OtherError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -781,7 +786,7 @@ struct VersionFile
|
|||||||
versionFile.order = order;
|
versionFile.order = order;
|
||||||
version->versionFiles.append(versionFile);
|
version->versionFiles.append(versionFile);
|
||||||
|
|
||||||
isError = false;
|
return NoApplyError;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -827,9 +832,8 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
|
|||||||
file.filename = "custom.json";
|
file.filename = "custom.json";
|
||||||
file.fileId = "org.multimc.custom.json";
|
file.fileId = "org.multimc.custom.json";
|
||||||
file.version = QString();
|
file.version = QString();
|
||||||
bool isError = false;
|
VersionFile::ApplyError error = file.applyTo(m_version);
|
||||||
file.applyTo(m_version, isError);
|
if (error == VersionFile::OtherError)
|
||||||
if (isError)
|
|
||||||
{
|
{
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
m_widgetParent, QObject::tr("Error"),
|
m_widgetParent, QObject::tr("Error"),
|
||||||
@ -838,6 +842,13 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
|
|||||||
.arg(root.absoluteFilePath("custom.json")));
|
.arg(root.absoluteFilePath("custom.json")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (error == VersionFile::LauncherVersionError)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(
|
||||||
|
m_widgetParent, QObject::tr("Error"),
|
||||||
|
QObject::tr("The version descriptors of this instance are now compatible with the current version of MultiMC"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -855,9 +866,8 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
|
|||||||
file.fileId = "org.multimc.version.json";
|
file.fileId = "org.multimc.version.json";
|
||||||
file.version = m_instance->intendedVersionId();
|
file.version = m_instance->intendedVersionId();
|
||||||
file.mcVersion = m_instance->intendedVersionId();
|
file.mcVersion = m_instance->intendedVersionId();
|
||||||
bool isError = false;
|
VersionFile::ApplyError error = file.applyTo(m_version);
|
||||||
file.applyTo(m_version, isError);
|
if (error == VersionFile::OtherError)
|
||||||
if (isError)
|
|
||||||
{
|
{
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
m_widgetParent, QObject::tr("Error"),
|
m_widgetParent, QObject::tr("Error"),
|
||||||
@ -866,6 +876,13 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
|
|||||||
.arg(root.absoluteFilePath("version.json")));
|
.arg(root.absoluteFilePath("version.json")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (error == VersionFile::LauncherVersionError)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(
|
||||||
|
m_widgetParent, QObject::tr("Error"),
|
||||||
|
QObject::tr("The version descriptors of this instance are now compatible with the current version of MultiMC"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!onlyVanilla)
|
if (!onlyVanilla)
|
||||||
@ -901,9 +918,8 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
|
|||||||
{
|
{
|
||||||
QLOG_DEBUG() << "Applying file with order" << order;
|
QLOG_DEBUG() << "Applying file with order" << order;
|
||||||
auto filePair = files[order];
|
auto filePair = files[order];
|
||||||
bool isError = false;
|
VersionFile::ApplyError error = filePair.second.applyTo(m_version);
|
||||||
filePair.second.applyTo(m_version, isError);
|
if (error == VersionFile::OtherError)
|
||||||
if (isError)
|
|
||||||
{
|
{
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
m_widgetParent, QObject::tr("Error"),
|
m_widgetParent, QObject::tr("Error"),
|
||||||
@ -911,6 +927,13 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
|
|||||||
"for more info.").arg(filePair.first));
|
"for more info.").arg(filePair.first));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (error == VersionFile::LauncherVersionError)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(
|
||||||
|
m_widgetParent, QObject::tr("Error"),
|
||||||
|
QObject::tr("The version descriptors of this instance are now compatible with the current version of MultiMC"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,14 +1012,21 @@ bool OneSixVersionBuilder::read(const QJsonObject &obj)
|
|||||||
QObject::tr("Error while reading. Please check MultiMC-0.log for more info."));
|
QObject::tr("Error while reading. Please check MultiMC-0.log for more info."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file.applyTo(m_version, isError);
|
VersionFile::ApplyError error = file.applyTo(m_version);
|
||||||
if (isError)
|
if (error == VersionFile::OtherError)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
m_widgetParent, QObject::tr("Error"),
|
m_widgetParent, QObject::tr("Error"),
|
||||||
QObject::tr("Error while applying. Please check MultiMC-0.log for more info."));
|
QObject::tr("Error while applying. Please check MultiMC-0.log for more info."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (error == VersionFile::LauncherVersionError)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(
|
||||||
|
m_widgetParent, QObject::tr("Error"),
|
||||||
|
QObject::tr("The version descriptors of this instance are now compatible with the current version of MultiMC"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user