From fee3dd685a6c8d2eaa3ba1fa7e1554d9ce15a4bd Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 15 Nov 2018 20:56:54 +0100 Subject: [PATCH] Auto-find Clazy documentation also with clazy >= 1.4 Summary: BUG: 401075 FIXED-IN: 5.3.1 Test Plan: Remove entries from kdeveloprc, paths are auto.detected both with clazy 1.4 and clazy 1.3 (well, its simulated doc path). Reviewers: #kdevelop, kfunk Reviewed By: #kdevelop, kfunk Subscribers: kfunk, kdevelop-devel Tags: #kdevelop Differential Revision: https://phabricator.kde.org/D16910 --- plugins/clazy/jobparameters.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/plugins/clazy/jobparameters.cpp b/plugins/clazy/jobparameters.cpp index d7eb2c963a..41b64852d4 100644 --- a/plugins/clazy/jobparameters.cpp +++ b/plugins/clazy/jobparameters.cpp @@ -109,16 +109,21 @@ QUrl JobGlobalParameters::defaultExecutablePath() QUrl JobGlobalParameters::defaultDocsPath() { - const auto docsPath = QStandardPaths::locate( - QStandardPaths::GenericDataLocation, + const QString subPathsCandidates[2]{ + // since clazy 1.4 + QStringLiteral("doc/clazy"), + // before QStringLiteral("clazy/doc"), - QStandardPaths::LocateDirectory); + }; + for (auto subPath : subPathsCandidates) { + const auto docsPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, subPath, QStandardPaths::LocateDirectory); - if (docsPath.isEmpty()) { - return {}; + if (!docsPath.isEmpty()) { + return QUrl::fromLocalFile(QDir(docsPath).canonicalPath()); + } } - return QUrl::fromLocalFile(QDir(docsPath).canonicalPath()); + return {}; } bool JobGlobalParameters::isValid() const -- GitLab