McuSupport: Use env variable as package's primary value

Use env variable value as primary source before values from settings
and fallback value from JSON.

Change-Id: I0c0a4c2cdac65a075d9f38aa1557a9d303b30a5e
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Piotr Mućko
2022-07-14 15:44:54 +02:00
parent 23d9ef1adb
commit ca9e652716
2 changed files with 8 additions and 3 deletions

View File

@@ -75,7 +75,11 @@ McuPackage::McuPackage(const SettingsHandler::Ptr &settingsHandler,
, m_downloadUrl(downloadUrl)
, m_addToSystemPath(addToSystemPath)
{
m_path = this->settingsHandler->getPath(settingsKey, QSettings::UserScope, m_defaultPath);
m_path = FilePath::fromString(
qEnvironmentVariable(m_environmentVariableName.toStdString().c_str()));
if (!m_path.exists()) {
m_path = this->settingsHandler->getPath(settingsKey, QSettings::UserScope, m_defaultPath);
}
}
QString McuPackage::label() const
@@ -125,7 +129,7 @@ FilePath McuPackage::path() const
FilePath McuPackage::defaultPath() const
{
return m_defaultPath;
return m_defaultPath.cleanPath();
}
FilePath McuPackage::detectionPath() const