CMake: Fix detection of help file

Amends 7c428e6b5c
that broke the detection.

Also fix that tool documentation was only detected when restoring
existing settings at startup.

Fixes: QTCREATORBUG-31927
Change-Id: I85f82a9fc83d7e655bf76d590638ab50d620fb53
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2024-10-31 13:17:42 +01:00
parent 18a240d85b
commit 61f6539779

View File

@@ -120,12 +120,10 @@ CMakeTool::CMakeTool(const Store &map, bool fromSdk) :
m_isAutoDetected = map.value(CMAKE_INFORMATION_AUTODETECTED, false).toBool(); m_isAutoDetected = map.value(CMAKE_INFORMATION_AUTODETECTED, false).toBool();
m_detectionSource = map.value(CMAKE_INFORMATION_DETECTIONSOURCE).toString(); m_detectionSource = map.value(CMAKE_INFORMATION_DETECTIONSOURCE).toString();
setFilePath(FilePath::fromSettings(map.value(CMAKE_INFORMATION_COMMAND)));
m_qchFilePath = FilePath::fromSettings(map.value(CMAKE_INFORMATION_QCH_FILE_PATH)); m_qchFilePath = FilePath::fromSettings(map.value(CMAKE_INFORMATION_QCH_FILE_PATH));
if (m_qchFilePath.isEmpty()) // setFilePath searches for qchFilePath if not already set
m_qchFilePath = searchQchFile(m_executable); setFilePath(FilePath::fromSettings(map.value(CMAKE_INFORMATION_COMMAND)));
} }
CMakeTool::~CMakeTool() = default; CMakeTool::~CMakeTool() = default;
@@ -143,6 +141,9 @@ void CMakeTool::setFilePath(const FilePath &executable)
m_introspection = std::make_unique<Internal::IntrospectionData>(); m_introspection = std::make_unique<Internal::IntrospectionData>();
m_executable = executable; m_executable = executable;
if (m_qchFilePath.isEmpty())
m_qchFilePath = searchQchFile(m_executable);
CMakeToolManager::notifyAboutUpdate(this); CMakeToolManager::notifyAboutUpdate(this);
} }
@@ -392,8 +393,8 @@ FilePath CMakeTool::searchQchFile(const FilePath &executable)
const FilePaths files = docDir.dirEntries(QStringList("*.qch")); const FilePaths files = docDir.dirEntries(QStringList("*.qch"));
for (const FilePath &docFile : files) { for (const FilePath &docFile : files) {
if (docFile.startsWith("cmake")) { if (docFile.fileName().startsWith("cmake", Qt::CaseInsensitive)) {
return docDir.resolvePath(docFile).absolutePath(); return docFile.absoluteFilePath();
} }
} }