forked from qt-creator/qt-creator
Boot2Qt: 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: I4b19d12cb45e3866131189781c824ab017373566 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -114,7 +114,7 @@ void QdbWatcher::forkHostServer()
|
|||||||
if (!executable.exists()) {
|
if (!executable.exists()) {
|
||||||
const QString message = tr("Could not find QDB host server executable. "
|
const QString message = tr("Could not find QDB host server executable. "
|
||||||
"You can set the location with environment variable %1.")
|
"You can set the location with environment variable %1.")
|
||||||
.arg(QLatin1String(overridingEnvironmentVariable(QdbTool::Qdb)));
|
.arg(overridingEnvironmentVariable(QdbTool::Qdb));
|
||||||
showMessage(message, true);
|
showMessage(message, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -28,7 +29,7 @@ static QString executableBaseName(QdbTool tool)
|
|||||||
|
|
||||||
Utils::FilePath findTool(QdbTool tool)
|
Utils::FilePath findTool(QdbTool tool)
|
||||||
{
|
{
|
||||||
QString filePath = QString::fromLocal8Bit(qgetenv(overridingEnvironmentVariable(tool)));
|
QString filePath = Utils::qtcEnvironmentVariable(overridingEnvironmentVariable(tool));
|
||||||
|
|
||||||
if (filePath.isEmpty()) {
|
if (filePath.isEmpty()) {
|
||||||
QSettings * const settings = Core::ICore::settings();
|
QSettings * const settings = Core::ICore::settings();
|
||||||
@@ -51,7 +52,7 @@ Utils::FilePath findTool(QdbTool tool)
|
|||||||
return Utils::FilePath::fromString(QDir::cleanPath(filePath));
|
return Utils::FilePath::fromString(QDir::cleanPath(filePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *overridingEnvironmentVariable(QdbTool tool)
|
QString overridingEnvironmentVariable(QdbTool tool)
|
||||||
{
|
{
|
||||||
switch (tool) {
|
switch (tool) {
|
||||||
case QdbTool::FlashingWizard:
|
case QdbTool::FlashingWizard:
|
||||||
@@ -59,7 +60,7 @@ const char *overridingEnvironmentVariable(QdbTool tool)
|
|||||||
case QdbTool::Qdb:
|
case QdbTool::Qdb:
|
||||||
return "BOOT2QT_QDB_FILEPATH";
|
return "BOOT2QT_QDB_FILEPATH";
|
||||||
}
|
}
|
||||||
QTC_ASSERT(false, return "");
|
QTC_ASSERT(false, return {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void showMessage(const QString &message, bool important)
|
void showMessage(const QString &message, bool important)
|
||||||
|
@@ -16,7 +16,7 @@ enum class QdbTool {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Utils::FilePath findTool(QdbTool tool);
|
Utils::FilePath findTool(QdbTool tool);
|
||||||
const char *overridingEnvironmentVariable(QdbTool tool);
|
QString overridingEnvironmentVariable(QdbTool tool);
|
||||||
void showMessage(const QString &message, bool important = false);
|
void showMessage(const QString &message, bool important = false);
|
||||||
QString settingsGroupKey();
|
QString settingsGroupKey();
|
||||||
QString settingsKey(QdbTool tool);
|
QString settingsKey(QdbTool tool);
|
||||||
|
Reference in New Issue
Block a user