d34e1ce051
OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/frameworkintegration?expand=0&rev=268
47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From 675802e706a737c008aa74600ac804b06db52140 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Lohnau <alexander.lohnau@gmx.de>
|
|
Date: Tue, 11 Jan 2022 06:42:03 +0100
|
|
Subject: [PATCH] Fix wrong porting of KNSCore::Engine::configSearchLocations
|
|
|
|
The `KNSCore::Engine::availableConfigFiles` method returns the file names, but
|
|
the code still assumed that the directories where the file is contained is returned.
|
|
Consequently the knsrc files would never be found.
|
|
|
|
BUG: 448237
|
|
---
|
|
src/kpackage-install-handlers/kns/main.cpp | 15 +++++++--------
|
|
1 file changed, 7 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/src/kpackage-install-handlers/kns/main.cpp b/src/kpackage-install-handlers/kns/main.cpp
|
|
index 9978844..a2b530e 100644
|
|
--- a/src/kpackage-install-handlers/kns/main.cpp
|
|
+++ b/src/kpackage-install-handlers/kns/main.cpp
|
|
@@ -70,17 +70,16 @@ int main(int argc, char **argv)
|
|
Q_ASSERT(url.scheme() == QLatin1String("kns"));
|
|
|
|
QString knsname;
|
|
- for (const auto &location : KNSCore::Engine::availableConfigFiles()) {
|
|
- QString candidate = location + QLatin1Char('/') + url.host();
|
|
- if (QFile::exists(candidate)) {
|
|
- knsname = candidate;
|
|
- break;
|
|
- }
|
|
- }
|
|
+ const QStringList availableConfigFiles = KNSCore::Engine::availableConfigFiles();
|
|
+ auto knsNameIt = std::find_if(availableConfigFiles.begin(), availableConfigFiles.end(), [&url](const QString &availableFile) {
|
|
+ return availableFile.endsWith(QLatin1String("/") + url.host());
|
|
+ });
|
|
|
|
- if (knsname.isEmpty()) {
|
|
+ if (knsNameIt == availableConfigFiles.end()) {
|
|
qWarning() << "couldn't find knsrc file for" << url.host();
|
|
return 1;
|
|
+ } else {
|
|
+ knsname = *knsNameIt;
|
|
}
|
|
|
|
const auto pathParts = url.path().split(QLatin1Char('/'), Qt::SkipEmptyParts);
|
|
--
|
|
2.34.1
|
|
|