McuSupport: Use settings before env var when setting package paths

If an environment variable corresponding to a package dependency
was set, this took precedence over the path set in the settings
file, making it impossible to change in the UI. With this change,
the environment variable is only used when no matching settings
entry is found.

Task-number: QTCREATORBUG-28488
Change-Id: Iee2e0bec402a4dce2f9590cd86ca3854e1e5ae90
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Sivert Krøvel
2023-03-13 12:41:33 +01:00
parent 15e1a64764
commit f4d72ebd79

View File

@@ -53,9 +53,9 @@ McuPackage::McuPackage(const SettingsHandler::Ptr &settingsHandler,
, m_addToSystemPath(addToSystemPath)
, m_valueType(valueType)
{
m_path = FilePath::fromUserInput(qtcEnvironmentVariable(m_environmentVariableName));
if (!m_path.exists()) {
m_path = this->settingsHandler->getPath(settingsKey, QSettings::UserScope, m_defaultPath);
m_path = this->settingsHandler->getPath(settingsKey, QSettings::UserScope, m_defaultPath);
if (m_path.isEmpty()) {
m_path = FilePath::fromUserInput(qtcEnvironmentVariable(m_environmentVariableName));
}
}