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

List:       kde-commits
Subject:    [kio] /: Look for kdesu in the correct location
From:       Marco Martin <notmart () gmail ! com>
Date:       2015-02-09 17:41:42
Message-ID: E1YKsL8-0005rO-Ok () scm ! kde ! org
[Download RAW message or body]

Git commit 5d70bd5de594ff40a009c0e783f9a0a7eed2f14e by Marco Martin.
Committed on 09/02/2015 at 17:39.
Pushed by mart into branch 'master'.

Look for kdesu in the correct location

Look for kdesu under CMAKE_INSTALL_FULL_LIBEXECDIR directory
patch by Maarten De Meyer

REVIEW:120185
CCMAIL:de.meyer.maarten@gmail.com

M  +2    -2    autotests/krununittest.cpp
M  +11   -1    src/core/desktopexecparser.cpp

http://commits.kde.org/kio/5d70bd5de594ff40a009c0e783f9a0a7eed2f14e

diff --git a/autotests/krununittest.cpp b/autotests/krununittest.cpp
index 73a3932..03cbde8 100644
--- a/autotests/krununittest.cpp
+++ b/autotests/krununittest.cpp
@@ -154,8 +154,8 @@ void KRunUnitTest::testProcessDesktopExec()
                 int pt = ex + te * 2 + su * 4;
                 QString exe;
                 if (pt == 4 || pt == 5) {
-                    exe = QStandardPaths::findExecutable("kdesu");
-                    if (exe.isEmpty()) {
+                    exe = QFile::decodeName(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kdesu");
+                    if (!QFile::exists(exe)) {
                         qWarning() << "kdesu not found, skipping test";
                         continue;
                     }
diff --git a/src/core/desktopexecparser.cpp b/src/core/desktopexecparser.cpp
index e20f046..7bb29ba 100644
--- a/src/core/desktopexecparser.cpp
+++ b/src/core/desktopexecparser.cpp
@@ -393,7 +393,17 @@ QStringList KIO::DesktopExecParser::resultingArguments() const
         if (d->service.terminal()) {
             result << "su";
         } else {
-            result << QStandardPaths::findExecutable("kdesu") << "-u";
+            QString kdesu = QFile::decodeName(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kdesu");
+            if (!QFile::exists(kdesu)) {
+                kdesu = QStandardPaths::findExecutable("kdesu");
+            }
+            if (!QFile::exists(kdesu)) {
+                // Insert kdesu as string so we show a nice warning: 'Could not launch kdesu'
+                result << QStringLiteral("kdesu");
+                return result;
+            } else {
+                result << kdesu << "-u";
+            }
         }
 
         result << d->service.username() << "-c";
[prev in list] [next in list] [prev in thread] [next in thread] 

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