ryujinx-greemdev: init at 1.2.76 (#353897)
[NixPkgs.git] / pkgs / development / libraries / qt-5 / 5.15 / qtdeclarative-qml-paths.patch
blobe207fa4df3bd4e5675beb9ccda9ad95a6685442c
1 diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
2 index 289f11d006..9b0a48c6c7 100644
3 --- a/src/qml/qml/qqmlimport.cpp
4 +++ b/src/qml/qml/qqmlimport.cpp
5 @@ -1897,17 +1897,22 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
6 addImportPath(installImportsPath);
8 // env import paths
9 - if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
10 - const QString envImportPath = qEnvironmentVariable("QML2_IMPORT_PATH");
11 + auto addEnvImportPath = [this](const char *var) {
12 #if defined(Q_OS_WIN)
13 QLatin1Char pathSep(';');
14 #else
15 QLatin1Char pathSep(':');
16 #endif
17 - QStringList paths = envImportPath.split(pathSep, Qt::SkipEmptyParts);
18 - for (int ii = paths.count() - 1; ii >= 0; --ii)
19 - addImportPath(paths.at(ii));
20 - }
21 + if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty(var))) {
22 + const QString envImportPath = qEnvironmentVariable(var);
23 + QStringList paths = envImportPath.split(pathSep, Qt::SkipEmptyParts);
24 + for (int ii = paths.count() - 1; ii >= 0; --ii)
25 + addImportPath(paths.at(ii));
26 + }
27 + };
29 + addEnvImportPath("QML2_IMPORT_PATH");
30 + addEnvImportPath("NIXPKGS_QT5_QML_IMPORT_PATH");
32 addImportPath(QStringLiteral("qrc:/qt-project.org/imports"));
33 addImportPath(QCoreApplication::applicationDirPath());