[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kio] src/widgets: Fix editing autostart entries when /usr/local/share/applications doesn't exist
From:       Antonio Rojas <arojas () archlinux ! org>
Date:       2016-10-31 20:37:58
Message-ID: E1c1JLC-0006AD-3W () code ! kde ! org
[Download RAW message or body]

Git commit af0105c22ec80e411bf226e77f40987464e478d3 by Antonio Rojas.
Committed on 31/10/2016 at 20:36.
Pushed by arojas into branch 'master'.

Fix editing autostart entries when /usr/local/share/applications doesn't exist

QFileInfo.canonicalFilePath() returns an empty string for non-existant directories, \
which matches any .desktop file path and makes KPropertiesDialog try to save it to \
the wrong location. Make sure that the dir exists before trying to match it in the \
.desktop file path

BUG: 371194
REVIEW: 129280
FIXED-IN: 5.28

M  +2    -1    src/widgets/kpropertiesdialog.cpp

http://commits.kde.org/kio/af0105c22ec80e411bf226e77f40987464e478d3

diff --git a/src/widgets/kpropertiesdialog.cpp b/src/widgets/kpropertiesdialog.cpp
index b570a85..18c8479 100644
--- a/src/widgets/kpropertiesdialog.cpp
+++ b/src/widgets/kpropertiesdialog.cpp
@@ -1239,7 +1239,8 @@ static QString relativeAppsLocation(const QString &file)
 {
     const QString canonical = QFileInfo(file).canonicalFilePath();
     Q_FOREACH (const QString &base, \
                QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation)) \
                {
-        if (canonical.startsWith(QFileInfo(base).canonicalFilePath())) {
+        QDir base_dir = QDir(base);
+        if (base_dir.exists() && canonical.startsWith(base_dir.canonicalPath())) {
             return canonical.mid(base.length() + 1);
         }
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic