forked from qt-creator/qt-creator
ProjectExplorer: (Re-)Add run config variables
As for the build config, we provide a global variant for use by external
tools, and one for use in the respective run configuration itself.
Also hide the deprecated "CurrentRun" variant, which was forgotten in
b55825a420.
Fixes: QTCREATORBUG-25561
Change-Id: I51aaff10301f7ff1256abf1c09ac9f5be136ab00
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -188,6 +188,24 @@ RunConfiguration::RunConfiguration(Target *target, Utils::Id id)
|
||||
BuildConfiguration *bc = target->activeBuildConfiguration();
|
||||
return bc ? bc->macroExpander() : target->macroExpander();
|
||||
});
|
||||
m_expander.registerPrefix("RunConfig:Env", tr("Variables in the run environment"),
|
||||
[this](const QString &var) {
|
||||
const auto envAspect = aspect<EnvironmentAspect>();
|
||||
return envAspect ? envAspect->environment().expandedValueForKey(var) : QString();
|
||||
});
|
||||
m_expander.registerVariable("RunConfig:WorkingDir",
|
||||
tr("The run configuration's working directory"),
|
||||
[this] {
|
||||
const auto wdAspect = aspect<WorkingDirectoryAspect>();
|
||||
return wdAspect ? wdAspect->workingDirectory(&m_expander).toString() : QString();
|
||||
});
|
||||
m_expander.registerVariable("RunConfig:Name", tr("The run configuration's name."),
|
||||
[this] { return displayName(); });
|
||||
m_expander.registerFileVariables("RunConfig:Executable",
|
||||
tr("The run configuration's executable."),
|
||||
[this] { return commandLine().executable().toString(); });
|
||||
|
||||
|
||||
m_commandLineGetter = [this] {
|
||||
FilePath executable;
|
||||
if (const auto executableAspect = aspect<ExecutableAspect>())
|
||||
|
||||
Reference in New Issue
Block a user