Commit 675802e7 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

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
parent da98905b
Pipeline #121963 passed with stage
in 47 seconds
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment