Warning, /graphics/digikam/project/bundles/3rdparty/ext_qt5/qt-appimage-support.patch is written in an unsupported language. File is not indexed.

0001 diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
0002 index 1a3cab275d..471223fe07 100644
0003 --- a/qtbase/src/platformsupport/services/genericunix/qgenericunixservices.cpp
0004 +++ b/qtbase/src/platformsupport/services/genericunix/qgenericunixservices.cpp
0005 @@ -170,7 +170,77 @@ static inline bool launch(const QString &launcher, const QUrl &url)
0006      bool ok = false;
0007      if (!args.isEmpty()) {
0008          QString program = args.takeFirst();
0009 -        ok = QProcess::startDetached(program, args);
0010 +
0011 +        QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
0012 +        qDebug() << env.toStringList();
0013 +
0014 +        // If we are running into AppImage bundle, switch env var to the right values.
0015 +        if (env.contains(QLatin1String("APPIMAGE_ORIGINAL_LD_LIBRARY_PATH")) &&
0016 +            env.contains(QLatin1String("APPIMAGE_ORIGINAL_QT_PLUGIN_PATH"))  &&
0017 +            env.contains(QLatin1String("APPIMAGE_ORIGINAL_XDG_DATA_DIRS"))   &&
0018 +            env.contains(QLatin1String("APPIMAGE_ORIGINAL_LD_PRELOAD"))      &&
0019 +            env.contains(QLatin1String("APPIMAGE_ORIGINAL_PATH")))
0020 +        {
0021 +            qDebug() << "Adjusting environment variables for AppImage bundle";
0022 +
0023 +            if (!env.value(QLatin1String("APPIMAGE_ORIGINAL_LD_LIBRARY_PATH")).isEmpty())
0024 +            {
0025 +                env.insert(QLatin1String("LD_LIBRARY_PATH"),
0026 +                           env.value(QLatin1String("APPIMAGE_ORIGINAL_LD_LIBRARY_PATH")));
0027 +            }
0028 +            else
0029 +            {
0030 +                env.remove(QLatin1String("LD_LIBRARY_PATH"));
0031 +            }
0032 +
0033 +            if (!env.value(QLatin1String("APPIMAGE_ORIGINAL_QT_PLUGIN_PATH")).isEmpty())
0034 +            {
0035 +                env.insert(QLatin1String("QT_PLUGIN_PATH"),
0036 +                           env.value(QLatin1String("APPIMAGE_ORIGINAL_QT_PLUGIN_PATH")));
0037 +            }
0038 +            else
0039 +            {
0040 +                env.remove(QLatin1String("QT_PLUGIN_PATH"));
0041 +            }
0042 +
0043 +            if (!env.value(QLatin1String("APPIMAGE_ORIGINAL_XDG_DATA_DIRS")).isEmpty())
0044 +            {
0045 +                env.insert(QLatin1String("XDG_DATA_DIRS"),
0046 +                           env.value(QLatin1String("APPIMAGE_ORIGINAL_XDG_DATA_DIRS")));
0047 +            }
0048 +            else
0049 +            {
0050 +                env.remove(QLatin1String("XDG_DATA_DIRS"));
0051 +            }
0052 +
0053 +            if (!env.value(QLatin1String("APPIMAGE_ORIGINAL_LD_PRELOAD")).isEmpty())
0054 +            {
0055 +                env.insert(QLatin1String("LD_PRELOAD"),
0056 +                           env.value(QLatin1String("APPIMAGE_ORIGINAL_LD_PRELOAD")));
0057 +            }
0058 +            else
0059 +            {
0060 +                env.remove(QLatin1String("LD_PRELOAD"));
0061 +            }
0062 +
0063 +            if (!env.value(QLatin1String("APPIMAGE_ORIGINAL_PATH")).isEmpty())
0064 +            {
0065 +                env.insert(QLatin1String("PATH"),
0066 +                           env.value(QLatin1String("APPIMAGE_ORIGINAL_PATH")));
0067 +            }
0068 +            else
0069 +            {
0070 +                env.remove(QLatin1String("PATH"));
0071 +            }
0072 +
0073 +            qDebug() << env.toStringList();
0074 +        }
0075 +
0076 +        QProcess process;
0077 +        process.setProcessEnvironment(env);
0078 +        process.setProgram(program);
0079 +        process.setArguments(args);
0080 +        ok = process.startDetached();
0081      }
0082  #endif
0083      if (!ok)