GH-1856 Fix metadata version and list loading
Shouldn't crash anymore, shouldn't overwrite data in some bad way anymore either.
This commit is contained in:
@ -385,6 +385,7 @@ bool MinecraftProfile::reapplyPatches()
|
||||
clear();
|
||||
for(auto file: m_patches)
|
||||
{
|
||||
qDebug() << "Applying" << file->getID() << (file->getProblemSeverity() == ProblemSeverity::Error ? "ERROR" : "GOOD");
|
||||
file->applyTo(this);
|
||||
}
|
||||
}
|
||||
@ -663,11 +664,6 @@ void MinecraftProfile::installJarMods(QStringList selectedFiles)
|
||||
m_strategy->installJarMods(selectedFiles);
|
||||
}
|
||||
|
||||
void MinecraftProfile::installVersion(BaseVersionPtr version)
|
||||
{
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: get rid of this. Get rid of all order numbers.
|
||||
*/
|
||||
|
@ -58,9 +58,6 @@ public:
|
||||
/// install more jar mods
|
||||
void installJarMods(QStringList selectedFiles);
|
||||
|
||||
/// install more jar mods
|
||||
void installVersion(BaseVersionPtr version);
|
||||
|
||||
/// DEPRECATED, remove ASAP
|
||||
int getFreeOrderNumber();
|
||||
|
||||
|
@ -17,6 +17,11 @@ ProfilePatch::ProfilePatch(std::shared_ptr<VersionFile> file, const QString& fil
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<Meta::Version> ProfilePatch::getMeta()
|
||||
{
|
||||
return m_metaVersion;
|
||||
}
|
||||
|
||||
void ProfilePatch::applyTo(MinecraftProfile* profile)
|
||||
{
|
||||
auto vfile = getVersionFile();
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
virtual QString getID();
|
||||
virtual QString getName();
|
||||
virtual QString getVersion();
|
||||
virtual std::shared_ptr<Meta::Version> getMeta();
|
||||
virtual QDateTime getReleaseDateTime();
|
||||
|
||||
virtual QString getFilename();
|
||||
|
@ -44,25 +44,36 @@ OneSixUpdate::OneSixUpdate(OneSixInstance *inst, QObject *parent) : Task(parent)
|
||||
m_tasks.append(std::make_shared<FoldersTask>(m_inst));
|
||||
}
|
||||
|
||||
// add a version update task, if necessary
|
||||
// add metadata update tasks, if necessary
|
||||
{
|
||||
/*
|
||||
* FIXME: there are some corner cases here that remain unhandled:
|
||||
* what if local load succeeds but remote fails? The version is still usable...
|
||||
* We should not rely on the remote to be there... and prefer local files if it does not respond.
|
||||
*/
|
||||
// FIXME: derive this from the actual list of version patches...
|
||||
auto loadVersion = [&](const QString & uid, const QString & version)
|
||||
qDebug() << "Updating patches...";
|
||||
auto profile = m_inst->getMinecraftProfile();
|
||||
m_inst->reloadProfile();
|
||||
for(int i = 0; i < profile->rowCount(); i++)
|
||||
{
|
||||
auto obj = ENV.metadataIndex()->get(uid, version);
|
||||
obj->load();
|
||||
auto task = obj->getCurrentTask();
|
||||
if(task)
|
||||
auto patch = profile->versionPatch(i);
|
||||
auto id = patch->getID();
|
||||
auto metadata = patch->getMeta();
|
||||
if(metadata)
|
||||
{
|
||||
m_tasks.append(task.unwrap());
|
||||
metadata->load();
|
||||
auto task = metadata->getCurrentTask();
|
||||
if(task)
|
||||
{
|
||||
qDebug() << "Loading remote meta patch" << id;
|
||||
m_tasks.append(task.unwrap());
|
||||
}
|
||||
}
|
||||
};
|
||||
loadVersion("org.lwjgl", m_inst->getComponentVersion("org.lwjgl"));
|
||||
loadVersion("net.minecraft", m_inst->getComponentVersion("net.minecraft"));
|
||||
else
|
||||
{
|
||||
qDebug() << "Ignoring local patch" << id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// libraries download
|
||||
|
Reference in New Issue
Block a user