From 3b56659226def6a172f2f2d3020c838509ea6edf Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 26 Nov 2019 12:57:06 +0200 Subject: [PATCH] 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 --- src/app/tape/main.cpp | 9 +++++++++ src/app/valentina/main.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/app/tape/main.cpp b/src/app/tape/main.cpp index e00db4af2..956df0bcf 100644 --- a/src/app/tape/main.cpp +++ b/src/app/tape/main.cpp @@ -31,6 +31,7 @@ #include "../fervor/fvupdater.h" #include "../vmisc/vsysexits.h" +#include #include // For QT_REQUIRE_VERSION #include @@ -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 diff --git a/src/app/valentina/main.cpp b/src/app/valentina/main.cpp index 94f6f9158..f6ef8f943 100644 --- a/src/app/valentina/main.cpp +++ b/src/app/valentina/main.cpp @@ -31,6 +31,7 @@ #include "../fervor/fvupdater.h" #include "../vpatterndb/vpiecenode.h" +#include #include // For QT_REQUIRE_VERSION #include @@ -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