From 5646f76ea8152434d8e109f41ea8e068fdc9fa85 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 3 Aug 2023 16:10:16 +0200 Subject: [PATCH] CMakePM: Fix reading ninjaPath from QtCreator.ini For the special case when the Qt SDK Installer appends the same path to the key. Task-number: QTBUG-115754 Change-Id: I87d8f3d8074044f440ed3042bc5fe8356a6c429c Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp b/src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp index 1fe948cc72a..17d4534ff8a 100644 --- a/src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp +++ b/src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp @@ -61,6 +61,12 @@ CMakeSpecificSettings::CMakeSpecificSettings() // never save this to the settings: ninjaPath.setToSettingsTransformation( [](const QVariant &) { return QVariant::fromValue(QString()); }); + ninjaPath.setFromSettingsTransformation([](const QVariant &from) { + // Sometimes the installer appends the same ninja path to the qtcreator.ini file + const QString path = from.canConvert() ? from.toStringList().last() + : from.toString(); + return FilePath::fromUserInput(path).toVariant(); + }); packageManagerAutoSetup.setSettingsKey("PackageManagerAutoSetup"); packageManagerAutoSetup.setDefaultValue(true);