summaryrefslogtreecommitdiffstats
path: root/logic/ftb
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-04-04 02:01:52 +0200
committerPetr Mrázek <peterix@gmail.com>2015-04-04 02:01:52 +0200
commitc7b39fe1165956d07055e7917b22d5604fb5f768 (patch)
treeb1a51bd74228bc1c708780031a4a685e1f2c0105 /logic/ftb
parent865b20057120a61cfd26f5eea9aa68243efc3319 (diff)
downloadMultiMC-c7b39fe1165956d07055e7917b22d5604fb5f768.tar
MultiMC-c7b39fe1165956d07055e7917b22d5604fb5f768.tar.gz
MultiMC-c7b39fe1165956d07055e7917b22d5604fb5f768.tar.lz
MultiMC-c7b39fe1165956d07055e7917b22d5604fb5f768.tar.xz
MultiMC-c7b39fe1165956d07055e7917b22d5604fb5f768.zip
NOISSUE Remove special FTB logic from generic version patch code
Diffstat (limited to 'logic/ftb')
-rw-r--r--logic/ftb/FTBProfileStrategy.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/logic/ftb/FTBProfileStrategy.cpp b/logic/ftb/FTBProfileStrategy.cpp
index 0a4984f7..20feba61 100644
--- a/logic/ftb/FTBProfileStrategy.cpp
+++ b/logic/ftb/FTBProfileStrategy.cpp
@@ -27,7 +27,7 @@ void FTBProfileStrategy::loadDefaultBuiltinPatches()
{
auto file = ProfileUtils::parseJsonFile(QFileInfo(mcJson), false);
file->fileId = "net.minecraft";
- file->name = "Minecraft (FTB tracked)";
+ file->name = QObject::tr("Minecraft (tracked)");
if(file->version.isEmpty())
{
file->version = mcVersion;
@@ -48,12 +48,33 @@ void FTBProfileStrategy::loadDefaultBuiltinPatches()
// load up the base minecraft patch
if(QFile::exists(mcJson))
{
- auto file = ProfileUtils::parseJsonFile(QFileInfo(mcJson), false, true);
+ auto file = ProfileUtils::parseJsonFile(QFileInfo(mcJson), false);
+
+ // adapt the loaded file - the FTB patch file format is different than ours.
+ file->addLibs = file->overwriteLibs;
+ file->overwriteLibs.clear();
+ file->shouldOverwriteLibs = false;
+ file->id.clear();
+ for(auto addLib: file->addLibs)
+ {
+ addLib->m_hint = "local";
+ addLib->insertType = RawLibrary::Prepend;
+ }
file->fileId = "org.multimc.ftb.pack";
- file->name = QString("%1 (FTB tracked)").arg(m_instance->name());
+ file->name = QObject::tr("%1 (FTB pack)").arg(m_instance->name());
if(file->version.isEmpty())
{
- file->version = mcVersion;
+ file->version = QObject::tr("Unknown");
+ QFile versionFile (PathCombine(m_instance->instanceRoot(), "version"));
+ if(versionFile.exists())
+ {
+ if(versionFile.open(QIODevice::ReadOnly))
+ {
+ // FIXME: just guessing the encoding/charset here.
+ auto version = QString::fromUtf8(versionFile.readAll());
+ file->version = version;
+ }
+ }
}
minecraftPatch = std::dynamic_pointer_cast<ProfilePatch>(file);
}