Skip to content

Commit

Permalink
Deduce plugin paths from PATH
Browse files Browse the repository at this point in the history
On NixOS, Qt plugins are not installed in a global location. Instead, we deduce
the locations of installed plugins from the PATH environment variable.
  • Loading branch information
ttuegel committed Oct 15, 2017
1 parent 0e98ce3 commit efad454
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/corelib/kernel/qcoreapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPaths()
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);
Expand Down

0 comments on commit efad454

Please sign in to comment.