diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-12-27 03:34:03 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-12-27 03:34:03 +0100 |
commit | e8063d193d56acc10c5a533cffd95c9271b24e65 (patch) | |
tree | f7ba9783d4c3fd2667f095417bce50f22789970a /application | |
parent | 7670d72bd9c8bb2adcecd2d04413a2abb9ac174f (diff) | |
download | MultiMC-e8063d193d56acc10c5a533cffd95c9271b24e65.tar MultiMC-e8063d193d56acc10c5a533cffd95c9271b24e65.tar.gz MultiMC-e8063d193d56acc10c5a533cffd95c9271b24e65.tar.lz MultiMC-e8063d193d56acc10c5a533cffd95c9271b24e65.tar.xz MultiMC-e8063d193d56acc10c5a533cffd95c9271b24e65.zip |
GH-1308 remove use of static data (translations) and root (notifications.json) paths.
Diffstat (limited to 'application')
-rw-r--r-- | application/MultiMC.cpp | 17 | ||||
-rw-r--r-- | application/MultiMC.h | 9 | ||||
-rw-r--r-- | application/pages/global/MultiMCPage.cpp | 3 |
3 files changed, 4 insertions, 25 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index 0cf6cf92..1c1fe835 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -126,6 +126,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar QString origcwdPath = QDir::currentPath(); QString binPath = applicationDirPath(); QString adjustedBy; + QString dataPath; // change directory QString dirParam = args["dir"].toString(); if (!dirParam.isEmpty()) @@ -170,17 +171,6 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar #endif } -// static data paths... mostly just for translations -#ifdef Q_OS_LINUX - QDir foo(FS::PathCombine(binPath, "..")); - staticDataPath = foo.absolutePath(); -#elif defined(Q_OS_WIN32) - staticDataPath = binPath; -#elif defined(Q_OS_MAC) - QDir foo(FS::PathCombine(rootPath, "Contents/Resources")); - staticDataPath = foo.absolutePath(); -#endif - // init the logger initLogger(); @@ -199,7 +189,6 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar } qDebug() << "Binary path : " << binPath; qDebug() << "Application root path : " << rootPath; - qDebug() << "Static data path : " << staticDataPath; // load settings initGlobalSettings(test_mode); @@ -239,7 +228,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar m_accounts->loadList(); // init the http meta cache - ENV.initHttpMetaCache(rootPath, staticDataPath); + ENV.initHttpMetaCache(); // create the global network manager ENV.m_qnam.reset(new QNetworkAccessManager(this)); @@ -330,7 +319,7 @@ void MultiMC::initTranslations() } m_mmc_translator.reset(new QTranslator()); - if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), staticDataPath + "/translations")) + if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), FS::PathCombine(QDir::currentPath(), "translations"))) { qDebug() << "Loading MMC Language File for" << locale.bcp47Name().toLocal8Bit().constData() << "..."; diff --git a/application/MultiMC.h b/application/MultiMC.h index f32772ef..492544fc 100644 --- a/application/MultiMC.h +++ b/application/MultiMC.h @@ -124,13 +124,6 @@ public: bool openJsonEditor(const QString &filename); protected: /* to be removed! */ - // FIXME: remove. used by MultiMCPage to enumerate translations. - /// this is the static data. it stores things that don't move. - const QString &staticData() - { - return staticDataPath; - } - // FIXME: remove. used by MainWindow to create application update tasks /// this is the root of the 'installation'. Used for automatic updates const QString &root() @@ -175,8 +168,6 @@ private: QMap<QString, std::shared_ptr<BaseDetachedToolFactory>> m_tools; QString rootPath; - QString staticDataPath; - QString dataPath; Status m_status = MultiMC::Failed; public: diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp index 5b7a1204..18f30010 100644 --- a/application/pages/global/MultiMCPage.cpp +++ b/application/pages/global/MultiMCPage.cpp @@ -336,8 +336,7 @@ void MultiMCPage::loadSettings() // Language ui->languageBox->clear(); ui->languageBox->addItem(tr("English"), QLocale(QLocale::English)); - foreach(const QString & lang, QDir(MMC->staticData() + "/translations") - .entryList(QStringList() << "*.qm", QDir::Files)) + for(const QString & lang: QDir("translations").entryList(QStringList() << "*.qm", QDir::Files)) { QLocale locale(lang.section(QRegExp("[_\\.]"), 1)); ui->languageBox->addItem(QLocale::languageToString(locale.language()), locale); |