forked from qt-creator/qt-creator
ProjectExplorer: Add CurrentRun:Env to the MacroExpander
Make RunConfigurations provide %{CurrentRun:Env:VARNAME} via the
macro expander infrastructure.
Change-Id: Ibf2d9d507294f0bc9a51a1521884b364e0c7955d
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "toolchain.h"
|
||||
#include "abi.h"
|
||||
#include "buildconfiguration.h"
|
||||
#include "environmentaspect.h"
|
||||
#include "kitinformation.h"
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
@@ -215,6 +216,11 @@ void RunConfiguration::ctor()
|
||||
BuildConfiguration *bc = target()->activeBuildConfiguration();
|
||||
return bc ? bc->macroExpander() : target()->macroExpander();
|
||||
});
|
||||
expander->registerPrefix(Constants::VAR_CURRENTRUN_ENV, tr("Variables in the current run environment"),
|
||||
[this](const QString &var) {
|
||||
const auto envAspect = extraAspect<EnvironmentAspect>();
|
||||
return envAspect ? envAspect->environment().value(var) : QString();
|
||||
});
|
||||
expander->registerVariable(Constants::VAR_CURRENTRUN_NAME,
|
||||
QCoreApplication::translate("ProjectExplorer", "The currently active run configuration's name."),
|
||||
[this] { return displayName(); }, false);
|
||||
|
||||
Reference in New Issue
Block a user