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 <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2023-08-03 16:10:16 +02:00
parent 9ad9e49ccf
commit 5646f76ea8

View File

@@ -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<QStringList>() ? from.toStringList().last()
: from.toString();
return FilePath::fromUserInput(path).toVariant();
});
packageManagerAutoSetup.setSettingsKey("PackageManagerAutoSetup");
packageManagerAutoSetup.setDefaultValue(true);