Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
windows:mingw:win64
mingw64-kinit
0006-Fix-finding-install-prefix.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0006-Fix-finding-install-prefix.patch of Package mingw64-kinit
From 83e78145faff99c17d43ec94aea5dab52ebe0a23 Mon Sep 17 00:00:00 2001 From: Ralf Habacker <ralf.habacker@freenet.de> Date: Thu, 22 Jul 2021 17:06:30 +0200 Subject: [PATCH 06/18] Fix finding install prefix QLibraryInfo::location(QLibraryInfo::PrefixPath) did not works as expected and returns '/', although a qt.conf file has been used. --- src/kdeinit/kinit_win.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/kdeinit/kinit_win.cpp b/src/kdeinit/kinit_win.cpp index 79e620b..f799f26 100644 --- a/src/kdeinit/kinit_win.cpp +++ b/src/kdeinit/kinit_win.cpp @@ -192,7 +192,24 @@ static PSID getCurrentProcessOwner() static QString installRoot() { - return QLibraryInfo::location(QLibraryInfo::PrefixPath); + char spath[MAX_PATH*2]; + HMODULE hm = NULL; + + if (GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + (LPCSTR) &installRoot, &hm) == 0) + { + return QString(CMAKE_INSTALL_PREFIX); + } + if (GetModuleFileNameA(hm, spath, sizeof(spath)) == 0) + { + return QString(CMAKE_INSTALL_PREFIX); + } + QString path = QString(spath).toLower(); + int index = path.lastIndexOf(QLatin1String("\\bin\\")); + if (index > -1) + path = path.left(index); + return path; } /** @@ -204,7 +221,7 @@ public: ProcessListEntry(HANDLE _handle, QString _path, int _pid, PSID _owner = 0) { QFileInfo p(_path); - path = p.absolutePath(); + path = p.absolutePath().replace("/", "\\").toLower(); name = p.baseName(); handle = _handle; pid = _pid; @@ -346,7 +363,7 @@ ProcessListEntry *ProcessList::find(const QString &name) continue; } - if (!ple->path.isEmpty() && !ple->path.toLower().startsWith(installPrefix.toLower())) { + if (!ple->path.isEmpty() && !ple->path.startsWith(installPrefix)) { // process is outside of installation directory qDebug() << "path of the process" << name << "seems to be outside of the installPath:" << ple->path << installPrefix; continue; @@ -432,7 +449,7 @@ void listAllRunningKDEProcesses(ProcessList &processList) const auto list = processList.list(); for (const ProcessListEntry *ple : list) { - if (!ple->path.isEmpty() && ple->path.toLower().startsWith(installPrefix.toLower())) { + if (!ple->path.isEmpty() && ple->path.startsWith(installPrefix)) { fprintf(stderr, "path: %s name: %s pid: %u\n", ple->path.toLatin1().data(), ple->name.toLatin1().data(), ple->pid); } } @@ -444,7 +461,7 @@ void terminateAllRunningKDEProcesses(ProcessList &processList) const auto list = processList.list(); for (const ProcessListEntry *ple : list) { - if (!ple->path.isEmpty() && ple->path.toLower().startsWith(installPrefix.toLower())) { + if (!ple->path.isEmpty() && ple->path.startsWith(installPrefix)) { if (verbose) { fprintf(stderr, "terminating path: %s name: %s pid: %u\n", ple->path.toLatin1().data(), ple->name.toLatin1().data(), ple->pid); } -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor