Debugger: 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: I3ea7623fb528e13a202afa2f89b00e5ee83962d8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2022-08-24 14:55:12 +02:00
parent a29ee883ae
commit d5bacfc087
9 changed files with 27 additions and 23 deletions

View File

@@ -31,6 +31,7 @@
#include <utils/algorithm.h>
#include <utils/checkablemessagebox.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/portlist.h>
#include <utils/qtcassert.h>
@@ -891,9 +892,9 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
setUseTerminal(allowTerminal == DoAllowTerminal && m_runParameters.useTerminal);
const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH");
const QString envBinary = qtcEnvironmentVariable("QTC_DEBUGGER_PATH");
if (!envBinary.isEmpty())
m_runParameters.debugger.command.setExecutable(FilePath::fromString(QString::fromLocal8Bit(envBinary)));
m_runParameters.debugger.command.setExecutable(FilePath::fromString(envBinary));
if (Project *project = runControl->project()) {
m_runParameters.projectSourceDirectory = project->projectDirectory();
@@ -903,7 +904,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
m_runParameters.toolChainAbi = ToolChainKitAspect::targetAbi(kit);
bool ok = false;
const int nativeMixedOverride = qEnvironmentVariableIntValue("QTC_DEBUGGER_NATIVE_MIXED", &ok);
const int nativeMixedOverride = qtcEnvironmentVariableIntValue("QTC_DEBUGGER_NATIVE_MIXED", &ok);
if (ok)
m_runParameters.nativeMixedEnabled = bool(nativeMixedOverride);