fix: build under non win32 platform

This commit is contained in:
Gary Wang 2020-01-05 15:22:47 +08:00
parent a41f2af021
commit 03bb25c3ae

View File

@ -5,6 +5,11 @@
#include <QTranslator> #include <QTranslator>
#include <QUrl> #include <QUrl>
// QM_FILE_INSTALL_DIR should be defined from the CMakeLists file.
#ifndef QM_FILE_INSTALL_DIR
#define QM_FILE_INSTALL_DIR ":/i18n/"
#endif // QM_FILE_INSTALL_DIR
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
@ -14,7 +19,7 @@ int main(int argc, char *argv[])
#ifdef _WIN32 #ifdef _WIN32
qmDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("translations"); qmDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("translations");
#else #else
qmDir = QString(QM_FILE_INSTALL_DIR); qmDir = QT_STRINGIFY(QM_FILE_INSTALL_DIR);
#endif #endif
translator.load(QString("PineapplePictures_%1").arg(QLocale::system().name()), qmDir); translator.load(QString("PineapplePictures_%1").arg(QLocale::system().name()), qmDir);
a.installTranslator(&translator); a.installTranslator(&translator);