diff --git a/src/kdeinit/kinit_win.cpp b/src/kdeinit/kinit_win.cpp --- a/src/kdeinit/kinit_win.cpp +++ b/src/kdeinit/kinit_win.cpp @@ -39,6 +39,7 @@ #include #include #include +#include // Under wince interface is defined, so undef it otherwise it breaks it #undef interface @@ -199,6 +200,11 @@ return getProcessOwner(GetCurrentProcess()); } +static QString installRoot() +{ + return QLibraryInfo::location(QLibraryInfo::PrefixPath); +} + /** holds single process */ @@ -342,6 +348,7 @@ ProcessListEntry *ProcessList::find(const QString &name) { ProcessListEntry *ple; + QString installPrefix = installRoot(); foreach (ple, m_processes) { if (ple->pid < 0) { qDebug() << "negative pid!"; @@ -352,9 +359,9 @@ continue; } - if (!ple->path.isEmpty() && !ple->path.toLower().startsWith(QString(QStringLiteral(CMAKE_INSTALL_PREFIX)).toLower())) { + if (!ple->path.isEmpty() && !ple->path.toLower().startsWith(installPrefix.toLower())) { // process is outside of installation directory - qDebug() << "path of the process" << name << "seems to be outside of the installPath:" << ple->path << QStringLiteral(CMAKE_INSTALL_PREFIX); + qDebug() << "path of the process" << name << "seems to be outside of the installPath:" << ple->path << installPrefix; continue; } return ple; @@ -434,7 +441,7 @@ void listAllRunningKDEProcesses(ProcessList &processList) { - QString installPrefix = QStringLiteral(CMAKE_INSTALL_PREFIX); + QString installPrefix = installRoot(); foreach (const ProcessListEntry *ple, processList.list()) { if (!ple->path.isEmpty() && ple->path.toLower().startsWith(installPrefix.toLower())) { @@ -445,7 +452,7 @@ void terminateAllRunningKDEProcesses(ProcessList &processList) { - QString installPrefix = QStringLiteral(CMAKE_INSTALL_PREFIX); + QString installPrefix = installRoot(); foreach (const ProcessListEntry *ple, processList.list()) { if (!ple->path.isEmpty() && ple->path.toLower().startsWith(installPrefix.toLower())) {