QCoreApplication::applicationDirPath returns empty string until we do not init

QApplication instance.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-11-26 16:44:52 +02:00
parent b724210bf9
commit f81d814bb2
3 changed files with 8 additions and 19 deletions

View File

@ -31,7 +31,6 @@
#include "../fervor/fvupdater.h"
#include "../vmisc/vsysexits.h"
#include <QtGlobal>
#include <QMessageBox> // For QT_REQUIRE_VERSION
#include <QTimer>
@ -46,14 +45,6 @@ int main(int argc, char *argv[])
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
#if defined(APPIMAGE)
/* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file.
* This prevents the library from using shared in memory data. There are few ways to resolve this issue. According
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
*/
qputenv("ICU_DATA", QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../share/icu")).toUtf8());
#endif
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();
#endif

View File

@ -31,7 +31,6 @@
#include "../fervor/fvupdater.h"
#include "../vpatterndb/vpiecenode.h"
#include <QtGlobal>
#include <QMessageBox> // For QT_REQUIRE_VERSION
#include <QTimer>
@ -50,14 +49,6 @@ int main(int argc, char *argv[])
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
#if defined(APPIMAGE)
/* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file.
* This prevents the library from using shared in memory data. There are few ways to resolve this issue. According
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
*/
qputenv("ICU_DATA", QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../share/icu")).toUtf8());
#endif
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();
#endif
@ -72,7 +63,6 @@ int main(int argc, char *argv[])
#endif //Q_OS_MAC
VApplication app(argc, argv);
app.InitOptions();
qDebug() << "ICU_DATA: " << qgetenv("ICU_DATA");

View File

@ -68,6 +68,14 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
openingPattern(false),
mode(Draw::Calculation)
{
#if defined(APPIMAGE)
/* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file.
* This prevents the library from using shared in memory data. There are few ways to resolve this issue. According
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
*/
qputenv("ICU_DATA", QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../share/icu")).toUtf8());
#endif
QString rules;
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 1)