NOISSUE Treat any forge downloads <= 4KB as stale.

This commit is contained in:
Petr Mrázek 2014-12-27 22:45:49 +01:00
parent a30a9559c7
commit 4db31aacd6

View File

@ -38,6 +38,7 @@
ForgeInstaller::ForgeInstaller() : BaseInstaller() ForgeInstaller::ForgeInstaller() : BaseInstaller()
{ {
} }
void ForgeInstaller::prepare(const QString &filename, const QString &universalUrl) void ForgeInstaller::prepare(const QString &filename, const QString &universalUrl)
{ {
std::shared_ptr<InstanceVersion> newVersion; std::shared_ptr<InstanceVersion> newVersion;
@ -117,6 +118,7 @@ void ForgeInstaller::prepare(const QString &filename, const QString &universalUr
m_forge_json = newVersion; m_forge_json = newVersion;
realVersionId = m_forge_json->id = installObj.value("minecraft").toString(); realVersionId = m_forge_json->id = installObj.value("minecraft").toString();
} }
bool ForgeInstaller::add(OneSixInstance *to) bool ForgeInstaller::add(OneSixInstance *to)
{ {
if (!BaseInstaller::add(to)) if (!BaseInstaller::add(to))
@ -161,7 +163,8 @@ bool ForgeInstaller::add(OneSixInstance *to)
{ {
QString forgeCoord("net.minecraftforge:forge:%1:universal"); QString forgeCoord("net.minecraftforge:forge:%1:universal");
// using insane form of the MC version... // using insane form of the MC version...
QString longVersion = m_forge_version->mcver + "-" + m_forge_version->jobbuildver; QString longVersion =
m_forge_version->mcver + "-" + m_forge_version->jobbuildver;
GradleSpecifier spec(forgeCoord.arg(longVersion)); GradleSpecifier spec(forgeCoord.arg(longVersion));
lib->setRawName(spec); lib->setRawName(spec);
} }
@ -358,6 +361,21 @@ protected:
} }
}; };
/*
* HACK IF the local non-stale file is too small, mark is as stale
*
* This fixes some problems with bad files acquired because of unhandled HTTP redirects
* in old versions of MultiMC.
*/
if (!entry->stale)
{
QFileInfo localFile(entry->getFullPath());
if (localFile.size() <= 0x4000)
{
entry->stale = true;
}
}
if (entry->stale) if (entry->stale)
{ {
NetJob *fjob = new NetJob("Forge download"); NetJob *fjob = new NetJob("Forge download");