nixpkgs/pkgs/development/libraries/qt-5/5.6/qtbase/library-paths.patch
Thomas Tuegel e6cf9b9df0
qt56: determine plugin and import paths from PATH
Plugin and QML import paths were previously determined by NIX_PROFILES. Using
PATH instead allows Qt applications to work under nix-shell without further modification.
2017-06-18 08:44:47 -05:00

20 lines
1.1 KiB
Diff

Index: qtbase-opensource-src-5.6.2/src/corelib/kernel/qcoreapplication.cpp
===================================================================
--- qtbase-opensource-src-5.6.2.orig/src/corelib/kernel/qcoreapplication.cpp
+++ qtbase-opensource-src-5.6.2/src/corelib/kernel/qcoreapplication.cpp
@@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPat
QStringList *app_libpaths = new QStringList;
coreappdata()->app_libpaths.reset(app_libpaths);
+ // Add library paths derived from PATH
+ const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
+ const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
+ for (const QString &path: paths) {
+ if (!path.isEmpty()) {
+ app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
+ }
+ }
+
const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
if (!libPathEnv.isEmpty()) {
QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);