summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-12-27 22:45:49 +0100
committerPetr Mrázek <peterix@gmail.com>2014-12-27 22:45:49 +0100
commit4db31aacd6902c8142a3b4bbaf3736a2108fe320 (patch)
tree86e76205f51e9d81e8622cc900d443097ecaf50d
parenta30a9559c749446165ec84e737fe85b44a462584 (diff)
downloadMultiMC-4db31aacd6902c8142a3b4bbaf3736a2108fe320.tar
MultiMC-4db31aacd6902c8142a3b4bbaf3736a2108fe320.tar.gz
MultiMC-4db31aacd6902c8142a3b4bbaf3736a2108fe320.tar.lz
MultiMC-4db31aacd6902c8142a3b4bbaf3736a2108fe320.tar.xz
MultiMC-4db31aacd6902c8142a3b4bbaf3736a2108fe320.zip
NOISSUE Treat any forge downloads <= 4KB as stale.
-rw-r--r--logic/forge/ForgeInstaller.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/logic/forge/ForgeInstaller.cpp b/logic/forge/ForgeInstaller.cpp
index 53370446..91af32af 100644
--- a/logic/forge/ForgeInstaller.cpp
+++ b/logic/forge/ForgeInstaller.cpp
@@ -38,6 +38,7 @@
ForgeInstaller::ForgeInstaller() : BaseInstaller()
{
}
+
void ForgeInstaller::prepare(const QString &filename, const QString &universalUrl)
{
std::shared_ptr<InstanceVersion> newVersion;
@@ -117,6 +118,7 @@ void ForgeInstaller::prepare(const QString &filename, const QString &universalUr
m_forge_json = newVersion;
realVersionId = m_forge_json->id = installObj.value("minecraft").toString();
}
+
bool ForgeInstaller::add(OneSixInstance *to)
{
if (!BaseInstaller::add(to))
@@ -134,7 +136,7 @@ bool ForgeInstaller::add(OneSixInstance *to)
QJsonArray librariesPlus;
// A blacklist
QSet<QString> blacklist{"authlib", "realms"};
- //
+ //
QList<QString> xzlist{"org.scala-lang", "com.typesafe"};
// for each library in the version we are adding (except for the blacklisted)
for (auto lib : m_forge_json->libraries)
@@ -151,7 +153,7 @@ bool ForgeInstaller::add(OneSixInstance *to)
// WARNING: This could actually break.
// if this is the actual forge lib, set an absolute url for the download
- if(m_forge_version->type == ForgeVersion::Gradle)
+ if (m_forge_version->type == ForgeVersion::Gradle)
{
if (libName == "forge")
{
@@ -159,9 +161,10 @@ bool ForgeInstaller::add(OneSixInstance *to)
}
else if (libName == "minecraftforge")
{
- QString forgeCoord ("net.minecraftforge:forge:%1:universal");
+ QString forgeCoord("net.minecraftforge:forge:%1:universal");
// 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));
lib->setRawName(spec);
}
@@ -176,10 +179,10 @@ bool ForgeInstaller::add(OneSixInstance *to)
// WARNING: This could actually break.
// mark bad libraries based on the xzlist above
- for(auto entry : xzlist)
+ for (auto entry : xzlist)
{
QLOG_DEBUG() << "Testing " << rawName << " : " << entry;
- if(rawName.startsWith(entry))
+ if (rawName.startsWith(entry))
{
lib->setHint("forge-pack-xz");
break;
@@ -279,7 +282,7 @@ bool ForgeInstaller::addLegacy(OneSixInstance *to)
{
return false;
}
- if (!QFile::copy(entry->getFullPath(),finalPath))
+ if (!QFile::copy(entry->getFullPath(), finalPath))
{
return false;
}
@@ -307,7 +310,7 @@ bool ForgeInstaller::addLegacy(OneSixInstance *to)
}
auto fullversion = to->getFullVersion();
fullversion->remove("net.minecraftforge");
-
+
QFile file(filename(to->instanceRoot()));
if (!file.open(QFile::WriteOnly))
{
@@ -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)
{
NetJob *fjob = new NetJob("Forge download");