From 868669a497fd08524eec6d31ac483f431b95198c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 13 May 2017 01:24:15 +0200 Subject: NOISSUE add a linux system packaging install layout --- api/logic/Env.cpp | 17 +++++++++++++++++ api/logic/Env.h | 2 ++ api/logic/java/JavaChecker.cpp | 4 +++- api/logic/minecraft/launch/LauncherPartLaunch.cpp | 3 ++- 4 files changed, 24 insertions(+), 2 deletions(-) (limited to 'api') 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 +#include #include #include #include #include "tasks/Task.h" #include "meta/Index.h" +#include "FileSystem.h" #include @@ -19,6 +21,7 @@ public: std::shared_ptr m_iconlist; QMap> m_versionLists; shared_qobject_ptr 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 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 #include +#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 #include #include +#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()) -- cgit v1.2.3