NOISSUE Use patch problems and problem levels instead of exceptions for minecraft profiles.

This commit is contained in:
Petr Mrázek
2016-03-18 15:02:54 +01:00
parent fb9dfcb951
commit b7d8e512f4
10 changed files with 172 additions and 147 deletions

View File

@ -463,23 +463,17 @@ QString OneSixInstance::currentVersionId() const
void OneSixInstance::reloadProfile()
{
try
m_profile->reload();
auto severity = m_profile->getProblemSeverity();
if(severity == ProblemSeverity::PROBLEM_ERROR)
{
m_profile->reload();
unsetFlag(VersionBrokenFlag);
emit versionReloaded();
}
catch (VersionIncomplete &error)
{
}
catch (Exception &error)
{
m_profile->clear();
setFlag(VersionBrokenFlag);
// TODO: rethrow to show some error message(s)?
emit versionReloaded();
throw;
}
else
{
unsetFlag(VersionBrokenFlag);
}
emit versionReloaded();
}
void OneSixInstance::clearProfile()

View File

@ -407,7 +407,7 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths)
profile->appendPatch(f);
}
profile->saveCurrentOrder();
profile->reapplySafe();
profile->reapplyPatches();
return true;
}

View File

@ -174,19 +174,10 @@ void OneSixUpdate::jarlibStart()
setStatus(tr("Getting the library files from Mojang..."));
qDebug() << m_inst->name() << ": downloading libraries";
OneSixInstance *inst = (OneSixInstance *)m_inst;
try
inst->reloadProfile();
if(inst->flags() & BaseInstance::VersionBrokenFlag)
{
inst->reloadProfile();
}
catch (Exception &e)
{
emitFailed(e.cause());
return;
}
catch (...)
{
emitFailed(tr("Failed to load the version description file for reasons unknown."));
return;
emitFailed(tr("Failed to load the version description files - check the instance for errors."));
}
// Build a list of URLs that will need to be downloaded.