From 7fd3a5e66e2b9e0f9b852f1ebfa942e31ab69e0d Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 23 Nov 2022 12:53:58 +0100 Subject: [PATCH] CMake: Use FilePath::suffix() instead of manual construction Change-Id: Id2bc542047ce5f4ff1937be90b976d330b69c51a Reviewed-by: Cristian Adam Reviewed-by: Qt CI Bot --- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 8e1f3b6e65e..8a05bd2bfbc 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -1143,9 +1143,8 @@ QList CMakeBuildSystem::findExtraCompilers() const FilePaths fileList = p->files([&fileExtensions](const Node *n) { if (!Project::SourceFiles(n) || !n->isEnabled()) // isEnabled excludes nodes from the file system tree return false; - const QString fp = n->filePath().toString(); - const int pos = fp.lastIndexOf('.'); - return pos >= 0 && fileExtensions.contains(fp.mid(pos + 1)); + const QString suffix = n->filePath().suffix(); + return !suffix.isEmpty() && fileExtensions.contains(suffix); }); qCDebug(cmakeBuildSystemLog) << "Finding Extra Compilers: Got list of files to check.";