forked from qt-creator/qt-creator
Various: 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: I724eecc040e33e249a88243f27e8a9e72e54f24b Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
#include <QSignalSpy>
|
||||
@@ -60,7 +62,7 @@ void AutoTestUnitTests::initTestCase()
|
||||
|
||||
m_tmpDir = new CppEditor::Tests::TemporaryCopiedDir(":/unit_test");
|
||||
|
||||
if (!qEnvironmentVariableIsEmpty("BOOST_INCLUDE_DIR")) {
|
||||
if (!qtcEnvironmentVariableIsEmpty("BOOST_INCLUDE_DIR")) {
|
||||
m_checkBoost = true;
|
||||
} else {
|
||||
if (Utils::HostOsInfo::isLinuxHost()
|
||||
@@ -178,7 +180,7 @@ void AutoTestUnitTests::testCodeParserSwitchStartup_data()
|
||||
|
||||
void AutoTestUnitTests::testCodeParserGTest()
|
||||
{
|
||||
if (qEnvironmentVariableIsEmpty("GOOGLETEST_DIR"))
|
||||
if (qtcEnvironmentVariableIsEmpty("GOOGLETEST_DIR"))
|
||||
QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)");
|
||||
|
||||
QFETCH(QString, projectFilePath);
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "cppchecktool.h"
|
||||
#include "cppchecktrigger.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/flowlayout.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/pathchooser.h>
|
||||
@@ -131,7 +132,7 @@ CppcheckOptionsPage::CppcheckOptionsPage(CppcheckTool &tool, CppcheckTrigger &tr
|
||||
if (HostOsInfo::isAnyUnixHost()) {
|
||||
options.binary = "cppcheck";
|
||||
} else {
|
||||
FilePath programFiles = FilePath::fromUserInput(qEnvironmentVariable("PROGRAMFILES"));
|
||||
FilePath programFiles = FilePath::fromUserInput(qtcEnvironmentVariable("PROGRAMFILES"));
|
||||
if (programFiles.isEmpty())
|
||||
programFiles = "C:/Program Files";
|
||||
options.binary = programFiles / "Cppcheck/cppcheck.exe";
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -291,14 +292,14 @@ static Utils::optional<HelpViewerFactory> backendForId(const QByteArray &id)
|
||||
|
||||
HelpViewerFactory LocalHelpManager::defaultViewerBackend()
|
||||
{
|
||||
const QByteArray backend = qgetenv("QTC_HELPVIEWER_BACKEND");
|
||||
const QString backend = Utils::qtcEnvironmentVariable("QTC_HELPVIEWER_BACKEND");
|
||||
if (!backend.isEmpty()) {
|
||||
const Utils::optional<HelpViewerFactory> factory = backendForId(backend);
|
||||
const Utils::optional<HelpViewerFactory> factory = backendForId(backend.toLatin1());
|
||||
if (factory)
|
||||
return *factory;
|
||||
}
|
||||
if (!backend.isEmpty())
|
||||
qWarning("Help viewer backend \"%s\" not found, using default.", backend.constData());
|
||||
qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend));
|
||||
const QVector<HelpViewerFactory> backends = viewerBackends();
|
||||
return backends.isEmpty() ? HelpViewerFactory() : backends.first();
|
||||
}
|
||||
|
@@ -21,8 +21,9 @@
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
@@ -381,7 +382,7 @@ QStringList PerfDataReader::findTargetArguments(const ProjectExplorer::RunContro
|
||||
|
||||
QString PerfDataReader::findPerfParser()
|
||||
{
|
||||
QString filePath = QString::fromLocal8Bit(qgetenv("PERFPROFILER_PARSER_FILEPATH"));
|
||||
QString filePath = Utils::qtcEnvironmentVariable("PERFPROFILER_PARSER_FILEPATH");
|
||||
if (filePath.isEmpty())
|
||||
filePath = Core::ICore::libexecPath("perfparser" QTC_HOST_EXE_SUFFIX).toString();
|
||||
return QDir::toNativeSeparators(QDir::cleanPath(filePath));
|
||||
|
@@ -91,7 +91,7 @@ static QString dataFile(const QString &file)
|
||||
static QString extraDataFile(const QString &file)
|
||||
{
|
||||
// Clone test data from: https://git.qt.io/chstenge/creator-test-data
|
||||
static QString prefix = QString::fromLocal8Bit(qgetenv("QTC_TEST_EXTRADATALOCATION"));
|
||||
static QString prefix = qtcEnvironmentVariable("QTC_TEST_EXTRADATALOCATION");
|
||||
if (prefix.isEmpty())
|
||||
return QString();
|
||||
|
||||
|
Reference in New Issue
Block a user