diff options
-rw-r--r-- | src/core/kconfig.cpp | 7 | ||||
-rw-r--r-- | src/core/kconfigini.cpp | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index bc2871c1..bdf89b1e 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -755,10 +755,13 @@ void KConfigPrivate::parseConfigFiles() files = getGlobalFiles(); } else { if (QDir::isAbsolutePath(fileName)) { - files << fileName; + const QString canonicalFile = QFileInfo(fileName).canonicalFilePath(); + if (!canonicalFile.isEmpty()) { // empty if it doesn't exist + files << canonicalFile; + } } else { Q_FOREACH (const QString &f, QStandardPaths::locateAll(resourceType, fileName)) { - files.prepend(f); + files.prepend(QFileInfo(f).canonicalFilePath()); } // allow fallback to config files bundled in resources diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp index b6749731..84d77b48 100644 --- a/src/core/kconfigini.cpp +++ b/src/core/kconfigini.cpp @@ -602,7 +602,11 @@ void KConfigIniBackend::setFilePath(const QString &file) if (info.exists()) { setLocalFilePath(info.canonicalFilePath()); } else { - setLocalFilePath(file); + const QString dir = info.dir().canonicalPath(); + if (!dir.isEmpty()) + setLocalFilePath(dir + QLatin1Char('/') + info.fileName()); + else + setLocalFilePath(file); } } |