MCU: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*

And instead of qgetenv.
Takes Qt Creator's setting at "Environment > System > Environment" into
account, which makes it easier on some platforms to set them (e.g.
macOS), can be configured differently in different settings paths, and
potentially can be changed at runtime (depending on usage).

Change-Id: Ib644dd6178bf9e0a1a75a2c6cf49fd5f3d121cf4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2022-08-24 14:57:06 +02:00
parent 27c8e2a638
commit c79d4bd606
3 changed files with 25 additions and 23 deletions

View File

@@ -15,6 +15,7 @@
#include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h>
#include <utils/algorithm.h>
#include <utils/environment.h>
#include <utils/infolabel.h>
#include <utils/pathchooser.h>
#include <utils/utilsicons.h>
@@ -53,8 +54,7 @@ McuPackage::McuPackage(const SettingsHandler::Ptr &settingsHandler,
, m_downloadUrl(downloadUrl)
, m_addToSystemPath(addToSystemPath)
{
m_path = FilePath::fromUserInput(
qEnvironmentVariable(m_environmentVariableName.toStdString().c_str()));
m_path = FilePath::fromUserInput(qtcEnvironmentVariable(m_environmentVariableName));
if (!m_path.exists()) {
m_path = this->settingsHandler->getPath(settingsKey, QSettings::UserScope, m_defaultPath);
}