Add static data path for ... static data. Like translations. Move translations there.

This commit is contained in:
Petr Mrázek 2014-05-17 18:21:32 +02:00
parent 8a8c4193e6
commit 7f2a16917e
4 changed files with 23 additions and 4 deletions

View file

@ -161,6 +161,17 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
#endif
}
// static data paths... mostly just for translations
#ifdef Q_OS_LINUX
QDir foo(PathCombine(binPath, ".."));
staticDataPath = foo.absolutePath();
#elif defined(Q_OS_WIN32)
staticDataPath = binPath;
#elif defined(Q_OS_MAC)
QDir foo(PathCombine(rootPath, "Contents/Resources"));
staticDataPath = foo.absolutePath();
#endif
// init the logger
initLogger();
@ -179,6 +190,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
}
QLOG_INFO() << "Binary path : " << binPath;
QLOG_INFO() << "Application root path : " << rootPath;
QLOG_INFO() << "Static data path : " << staticDataPath;
// load settings
initGlobalSettings();
@ -287,7 +299,8 @@ void MultiMC::initTranslations()
}
m_mmc_translator.reset(new QTranslator());
if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), MMC->root() + "/translations"))
if (m_mmc_translator->load("mmc_" + locale.bcp47Name(),
MMC->staticData() + "/translations"))
{
QLOG_DEBUG() << "Loading MMC Language File for"
<< locale.bcp47Name().toLocal8Bit().constData() << "...";