diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-05-13 01:24:15 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-05-13 01:24:15 +0200 |
commit | 868669a497fd08524eec6d31ac483f431b95198c (patch) | |
tree | a46fa4fa4e6baaf14720f10b3a2d09df3c98aaf6 /api | |
parent | 4cf4110d9dc694d2c28feca38656925980b57a4d (diff) | |
download | MultiMC-868669a497fd08524eec6d31ac483f431b95198c.tar MultiMC-868669a497fd08524eec6d31ac483f431b95198c.tar.gz MultiMC-868669a497fd08524eec6d31ac483f431b95198c.tar.lz MultiMC-868669a497fd08524eec6d31ac483f431b95198c.tar.xz MultiMC-868669a497fd08524eec6d31ac483f431b95198c.zip |
NOISSUE add a linux system packaging install layout
Diffstat (limited to 'api')
-rw-r--r-- | api/logic/Env.cpp | 17 | ||||
-rw-r--r-- | api/logic/Env.h | 2 | ||||
-rw-r--r-- | api/logic/java/JavaChecker.cpp | 4 | ||||
-rw-r--r-- | api/logic/minecraft/launch/LauncherPartLaunch.cpp | 3 |
4 files changed, 24 insertions, 2 deletions
diff --git a/api/logic/Env.cpp b/api/logic/Env.cpp index d7be4a28..59d4c4a8 100644 --- a/api/logic/Env.cpp +++ b/api/logic/Env.cpp @@ -3,11 +3,13 @@ #include "BaseVersion.h" #include "BaseVersionList.h" #include <QDir> +#include <QCoreApplication> #include <QNetworkProxy> #include <QNetworkAccessManager> #include <QDebug> #include "tasks/Task.h" #include "meta/Index.h" +#include "FileSystem.h" #include <QDebug> @@ -19,6 +21,7 @@ public: std::shared_ptr<IIconList> m_iconlist; QMap<QString, std::shared_ptr<BaseVersionList>> m_versionLists; shared_qobject_ptr<Meta::Index> m_metadataIndex; + QString m_jarsPath; }; static Env * instance; @@ -190,4 +193,18 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr qDebug() << proxyDesc; } +QString Env::getJarsPath() +{ + if(d->m_jarsPath.isEmpty()) + { + return FS::PathCombine(QCoreApplication::applicationDirPath(), "jars"); + } + return d->m_jarsPath; +} + +void Env::setJarsPath(const QString& path) +{ + d->m_jarsPath = path; +} + #include "Env.moc" diff --git a/api/logic/Env.h b/api/logic/Env.h index 75ebe4a0..08b1dd0d 100644 --- a/api/logic/Env.h +++ b/api/logic/Env.h @@ -59,6 +59,8 @@ public: shared_qobject_ptr<Meta::Index> metadataIndex(); + QString getJarsPath(); + void setJarsPath(const QString & path); protected: Private * d; }; diff --git a/api/logic/java/JavaChecker.cpp b/api/logic/java/JavaChecker.cpp index daf375ad..ebbd80be 100644 --- a/api/logic/java/JavaChecker.cpp +++ b/api/logic/java/JavaChecker.cpp @@ -7,13 +7,15 @@ #include <QCoreApplication> #include <QDebug> +#include "Env.h" + JavaChecker::JavaChecker(QObject *parent) : QObject(parent) { } void JavaChecker::performCheck() { - QString checkerJar = FS::PathCombine(QCoreApplication::applicationDirPath(), "jars", "JavaCheck.jar"); + QString checkerJar = FS::PathCombine(ENV.getJarsPath(), "JavaCheck.jar"); QStringList args; diff --git a/api/logic/minecraft/launch/LauncherPartLaunch.cpp b/api/logic/minecraft/launch/LauncherPartLaunch.cpp index b69ae413..d9441e56 100644 --- a/api/logic/minecraft/launch/LauncherPartLaunch.cpp +++ b/api/logic/minecraft/launch/LauncherPartLaunch.cpp @@ -19,6 +19,7 @@ #include <minecraft/MinecraftInstance.h> #include <FileSystem.h> #include <QStandardPaths> +#include "Env.h" LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent) { @@ -43,7 +44,7 @@ void LauncherPartLaunch::executeTask() // make detachable - this will keep the process running even if the object is destroyed m_process.setDetachable(true); - args << "-jar" << FS::PathCombine(QCoreApplication::applicationDirPath(), "jars", "NewLaunch.jar"); + args << "-jar" << FS::PathCombine(ENV.getJarsPath(), "NewLaunch.jar"); QString wrapperCommand = instance->getWrapperCommand(); if(!wrapperCommand.isEmpty()) |