3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/libraries/qt-5/5.8/qtbase/xdg-config-dirs.patch
Thomas Tuegel cd7d8a60b4
qt58: init at 5.8.0
Qt 5.8 is now the default version.
2017-03-04 15:08:47 -06:00

42 lines
2 KiB
Diff

Index: qtbase-opensource-src-5.7.0/src/corelib/io/qsettings.cpp
===================================================================
--- qtbase-opensource-src-5.7.0.orig/src/corelib/io/qsettings.cpp
+++ qtbase-opensource-src-5.7.0/src/corelib/io/qsettings.cpp
@@ -1161,6 +1161,23 @@ QConfFileSettingsPrivate::QConfFileSetti
confFiles[F_System | F_Application].reset(QConfFile::fromName(systemPath + appFile, false));
confFiles[F_System | F_Organization].reset(QConfFile::fromName(systemPath + orgFile, false));
+#if !defined(Q_OS_WIN)
+ // Add directories specified in $XDG_CONFIG_DIRS
+ const QString pathEnv = QString::fromLocal8Bit(getenv("XDG_CONFIG_DIRS"));
+ if (!pathEnv.isEmpty()) {
+ const QStringList pathEntries = pathEnv.split(QLatin1Char(':'), QString::SkipEmptyParts);
+ if (!pathEntries.isEmpty()) {
+ int j = 4; // This is the number of confFiles set above -- we need to start adding $XDG_CONFIG_DIRS after those.
+ for (int k = 0; k < pathEntries.size() && j < NumConfFiles - 1; ++k) {
+ const QString& path = pathEntries.at(k);
+ if (!application.isEmpty())
+ confFiles[j++].reset(QConfFile::fromName(path + QDir::separator() + appFile, false));
+ confFiles[j++].reset(QConfFile::fromName(path + QDir::separator() + orgFile, false));
+ }
+ }
+ }
+#endif
+
for (i = 0; i < NumConfFiles; ++i) {
if (confFiles[i]) {
spec = i;
Index: qtbase-opensource-src-5.7.0/src/corelib/io/qsettings_p.h
===================================================================
--- qtbase-opensource-src-5.7.0.orig/src/corelib/io/qsettings_p.h
+++ qtbase-opensource-src-5.7.0/src/corelib/io/qsettings_p.h
@@ -246,7 +246,7 @@ public:
F_Organization = 0x1,
F_User = 0x0,
F_System = 0x2,
- NumConfFiles = 4
+ NumConfFiles = 40 // HACK: increase NumConfFiles from 4 to 40 in order to accommodate more paths in $XDG_CONFIG_DIRS -- ellis
};
QSettings::Format format;