From 3ad00c4e56eb9fe6ea7386f8ca1db6e15c26ac11 Mon Sep 17 00:00:00 2001 From: Wolfgang Bauer Date: Tue, 25 Apr 2017 23:37:11 +0200 Subject: 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 --- src/core/kdesktopfile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/kdesktopfile.cpp') 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()) { -- cgit v1.2.1