diff options
author | Jeremy Whiting <jpwhiting@kde.org> | 2020-09-13 22:39:34 -0600 |
---|---|---|
committer | Jeremy Whiting <jpwhiting@kde.org> | 2020-09-14 12:18:12 -0600 |
commit | 0283103ff2286a2bc54e6e3abb508bd00c8b9d57 (patch) | |
tree | 6caffc9f9ec997993f02682406c833ae46627f9c /src/core/kdesktopfile.cpp | |
parent | c7708ffb77debb58103f6cbb7baf3c305db03b28 (diff) | |
download | kconfig-0283103ff2286a2bc54e6e3abb508bd00c8b9d57.tar.gz kconfig-0283103ff2286a2bc54e6e3abb508bd00c8b9d57.tar.bz2 |
Use reverse order in KDesktopFile::locateLocal to iterate over generic config paths.
Since windows has some generic config paths that are parents of other generic config paths
e.g. c:/CraftRoot/build/_/<hash>/build/bin followed by c:/CraftRoot/build/_/<hash>/build/bin/data
we need to search for locations from the last location to the first.
Diffstat (limited to 'src/core/kdesktopfile.cpp')
-rw-r--r-- | src/core/kdesktopfile.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/kdesktopfile.cpp b/src/core/kdesktopfile.cpp index 41f9e818..0dccd2d2 100644 --- a/src/core/kdesktopfile.cpp +++ b/src/core/kdesktopfile.cpp @@ -70,7 +70,11 @@ QString KDesktopFile::locateLocal(const QString &path) QChar plus(QLatin1Char('/')); // Relative to config? (e.g. for autostart) const QStringList lstGenericConfigLocation = QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation); - for (const QString &dir : lstGenericConfigLocation) { + // Iterate from the last item since some items may be subfolders of others. + for (QStringList::const_reverse_iterator constIterator = lstGenericConfigLocation.crbegin(); + constIterator != lstGenericConfigLocation.crend(); + ++constIterator) { + const QString &dir = (*constIterator); if (path.startsWith(dir + plus)) { relativePath = path.mid(dir.length() + 1); return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + relativePath; |