Windows client: translation path fix

This commit is contained in:
Max-Wilhelm Bruker 2012-06-27 20:41:42 +02:00
parent 371299551b
commit c7131e3a1d
2 changed files with 11 additions and 8 deletions

View file

@ -160,12 +160,6 @@ SET(cockatrice_HEADERS
if (UNIX)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/cockatrice/translations\\")
endif (UNIX)
if (WIN32)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"translations\\")
endif (WIN32)
if (APPLE)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"../../../translations\\")
endif (APPLE)
set(cockatrice_RESOURCES cockatrice.qrc)
set(cockatrice_TS

View file

@ -69,8 +69,6 @@ void installNewTranslator()
qtTranslator->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
qApp->installTranslator(qtTranslator);
if (!translationPath.startsWith("/"))
translationPath.prepend(qApp->applicationDirPath() + "/");
translator->load(translationPrefix + "_" + lang, translationPath);
qApp->installTranslator(translator);
}
@ -99,6 +97,17 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationDomain("cockatrice.de");
QCoreApplication::setApplicationName("Cockatrice");
if (translationPath.isEmpty()) {
#ifdef Q_OS_MAC
QDir translationsDir = baseDir;
translationsDir.cd("translations");
translationPath = translationsDir.absolutePath();
#endif
#ifdef Q_OS_WIN
translationPath = app.applicationDirPath() + "/translations";
#endif
}
rng = new RNG_SFMT;
settingsCache = new SettingsCache;
db = new CardDatabase;