Set environment variable ICU_DATA on runtime.

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().

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-11-26 12:57:06 +02:00
parent a59f4d7923
commit 3b56659226
2 changed files with 18 additions and 0 deletions

View file

@ -31,6 +31,7 @@
#include "../fervor/fvupdater.h"
#include "../vmisc/vsysexits.h"
#include <QtGlobal>
#include <QMessageBox> // For QT_REQUIRE_VERSION
#include <QTimer>
@ -45,6 +46,14 @@ 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,6 +31,7 @@
#include "../fervor/fvupdater.h"
#include "../vpatterndb/vpiecenode.h"
#include <QtGlobal>
#include <QMessageBox> // For QT_REQUIRE_VERSION
#include <QTimer>
@ -49,6 +50,14 @@ 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