From c9832d0d8603ba2420a093f44cb5037e18e938f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Thu, 29 Mar 2018 20:55:47 +0200 Subject: GH-2208 fix FTB pack download caching --- api/logic/Env.cpp | 1 + api/logic/modplatform/ftb/FtbPackInstallTask.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/logic/Env.cpp b/api/logic/Env.cpp index cf321af2..04a5ab23 100644 --- a/api/logic/Env.cpp +++ b/api/logic/Env.cpp @@ -95,6 +95,7 @@ void Env::initHttpMetaCache() m_metacache->addBase("fmllibs", QDir("mods/minecraftforge/libs").absolutePath()); m_metacache->addBase("liteloader", QDir("mods/liteloader").absolutePath()); m_metacache->addBase("general", QDir("cache").absolutePath()); + m_metacache->addBase("FTBPacks", QDir("cache/FTBPacks").absolutePath()); m_metacache->addBase("skins", QDir("accounts/skins").absolutePath()); m_metacache->addBase("root", QDir::currentPath()); m_metacache->addBase("translations", QDir("translations").absolutePath()); diff --git a/api/logic/modplatform/ftb/FtbPackInstallTask.cpp b/api/logic/modplatform/ftb/FtbPackInstallTask.cpp index e3bb2340..b57c2092 100644 --- a/api/logic/modplatform/ftb/FtbPackInstallTask.cpp +++ b/api/logic/modplatform/ftb/FtbPackInstallTask.cpp @@ -24,11 +24,12 @@ void FtbPackInstallTask::downloadPack() { setStatus(tr("Downloading zip for %1").arg(m_pack.name)); - auto entry = ENV.metacache()->resolveEntry("general", "FTBPacks/" + m_pack.name); - NetJob *job = new NetJob("Downlad FTB Pack"); + auto packoffset = QString("%1/%2/%3").arg(m_pack.dir, m_version.replace(".", "_"), m_pack.file); + auto entry = ENV.metacache()->resolveEntry("FTBPacks", packoffset); + NetJob *job = new NetJob("Download FTB Pack"); entry->setStale(true); - QString url = QString("http://ftb.cursecdn.com/FTB2/modpacks/%1/%2/%3").arg(m_pack.dir, m_version.replace(".", "_"), m_pack.file); + QString url = QString("http://ftb.cursecdn.com/FTB2/modpacks/%1").arg(packoffset); job->addNetAction(Net::Download::makeCached(url, entry)); archivePath = entry->getFullPath(); -- cgit v1.2.3