From 43881b9cdba95259395c8bf633b670c8a6fead9a Mon Sep 17 00:00:00 2001 From: Jan Dalheimer Date: Thu, 20 Feb 2014 17:06:32 +0100 Subject: [PATCH] Use FTB's libraries/ and versions/ folders for non-copied instances --- logic/OneSixFTBInstance.cpp | 9 +++++++++ logic/OneSixFTBInstance.h | 3 +++ logic/OneSixInstance.cpp | 17 ++++++++++++----- logic/OneSixInstance.h | 3 +++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/logic/OneSixFTBInstance.cpp b/logic/OneSixFTBInstance.cpp index ca88142a..8f745f93 100644 --- a/logic/OneSixFTBInstance.cpp +++ b/logic/OneSixFTBInstance.cpp @@ -95,6 +95,15 @@ QString OneSixFTBInstance::id() const return "FTB/" + BaseInstance::id(); } +QDir OneSixFTBInstance::librariesPath() const +{ + return QDir(MMC->settings()->get("FTBRoot").toString() + "/libraries"); +} +QDir OneSixFTBInstance::versionsPath() const +{ + return QDir(MMC->settings()->get("FTBRoot").toString() + "/versions"); +} + QString OneSixFTBInstance::getStatusbarDescription() { return "OneSix FTB: " + intendedVersionId(); diff --git a/logic/OneSixFTBInstance.h b/logic/OneSixFTBInstance.h index bc543aeb..d3ceb190 100644 --- a/logic/OneSixFTBInstance.h +++ b/logic/OneSixFTBInstance.h @@ -17,6 +17,9 @@ public: virtual QString id() const; + virtual QDir librariesPath() const override; + virtual QDir versionsPath() const override; + private: std::shared_ptr m_forge; }; diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index ae172f21..8b4de641 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -192,12 +192,10 @@ MinecraftProcess *OneSixInstance::prepareForLaunch(AuthSessionPtr session) auto libs = version->getActiveNormalLibs(); for (auto lib : libs) { - QFileInfo fi(QString("libraries/") + lib->storagePath()); - launchScript += "cp " + fi.absoluteFilePath() + "\n"; + launchScript += "cp " + librariesPath().absoluteFilePath(lib->storagePath()) + "\n"; } - QString targetstr = "versions/" + version->id + "/" + version->id + ".jar"; - QFileInfo fi(targetstr); - launchScript += "cp " + fi.absoluteFilePath() + "\n"; + QString targetstr = version->id + "/" + version->id + ".jar"; + launchScript += "cp " + versionsPath().absoluteFilePath(targetstr) + "\n"; } launchScript += "mainClass " + version->mainClass + "\n"; @@ -374,6 +372,15 @@ QString OneSixInstance::getStatusbarDescription() return descr; } +QDir OneSixInstance::librariesPath() const +{ + return QDir::current().absoluteFilePath("libraries"); +} +QDir OneSixInstance::versionsPath() const +{ + return QDir::current().absoluteFilePath("versions"); +} + QString OneSixInstance::loaderModsDir() const { return PathCombine(minecraftRoot(), "mods"); diff --git a/logic/OneSixInstance.h b/logic/OneSixInstance.h index ae95eab1..4ea5fce1 100644 --- a/logic/OneSixInstance.h +++ b/logic/OneSixInstance.h @@ -68,6 +68,9 @@ public: virtual bool menuActionEnabled(QString action_name) const override; virtual QString getStatusbarDescription() override; + virtual QDir librariesPath() const; + virtual QDir versionsPath() const; + signals: void versionReloaded();