diff options
author | Wolfgang Bauer <wbauer@tmo.at> | 2017-04-25 23:37:11 +0200 |
---|---|---|
committer | Wolfgang Bauer <wbauer@tmo.at> | 2017-04-25 23:37:11 +0200 |
commit | 3ad00c4e56eb9fe6ea7386f8ca1db6e15c26ac11 (patch) | |
tree | e746c2ebd422c36d2f551bc590d160c2be02426d /src/core | |
parent | e56d8e55d35ebf6ab66a58000dc19dd863d7ad58 (diff) | |
download | kconfig-3ad00c4e56eb9fe6ea7386f8ca1db6e15c26ac11.tar.gz kconfig-3ad00c4e56eb9fe6ea7386f8ca1db6e15c26ac11.tar.bz2 |
Fix relativePath calculation in KDesktopFile::locateLocal()
The "dir" and "path" variables were obviously swapped here by mistake.
This resulted in the relativePath always being empty, and made the
function return "~/.local/share/" (or "~/.config/") instead of the
correct path.
BUG: 345100
FIXED-IN: 5.34.0
Differential Revision: https://phabricator.kde.org/D5502
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/kdesktopfile.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/kdesktopfile.cpp b/src/core/kdesktopfile.cpp index 4a550302..52a97ec7 100644 --- a/src/core/kdesktopfile.cpp +++ b/src/core/kdesktopfile.cpp @@ -83,14 +83,14 @@ QString KDesktopFile::locateLocal(const QString &path) // Relative to config? (e.g. for autostart) Q_FOREACH (const QString &dir, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) { if (path.startsWith(dir + plus)) { - relativePath = dir.mid(path.length() + 1); + relativePath = path.mid(dir.length() + 1); return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + relativePath; } } // Relative to xdg data dir? (much more common) Q_FOREACH (const QString &dir, QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)) { if (path.startsWith(dir + plus)) { - relativePath = dir.mid(path.length() + 1); + relativePath = path.mid(dir.length() + 1); } } if (relativePath.isEmpty()) { |