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:
Christian Kandeler
2021-04-08 14:17:42 +02:00
parent 24d88de228
commit 65db684c7d
3 changed files with 61 additions and 4 deletions

View File

@@ -174,14 +174,14 @@ Target::Target(Project *project, Kit *k, _constructor_tag) :
if (RunConfiguration * const rc = activeRunConfiguration())
return rc->displayName();
return QString();
});
}, false);
d->m_macroExpander.registerFileVariables("CurrentRun:Executable",
tr("The currently active run configuration's executable (if applicable)."),
[this]() -> QString {
if (RunConfiguration * const rc = activeRunConfiguration())
return rc->commandLine().executable().toString();
return QString();
});
}, false);
d->m_macroExpander.registerPrefix("CurrentRun:Env", tr("Variables in the current run environment."),
[this](const QString &var) {
if (RunConfiguration * const rc = activeRunConfiguration()) {
@@ -189,7 +189,7 @@ Target::Target(Project *project, Kit *k, _constructor_tag) :
return envAspect->environment().expandedValueForKey(var);
}
return QString();
});
}, false);
d->m_macroExpander.registerVariable("CurrentRun:WorkingDir",
tr("The currently active run configuration's working directory."),
[this] {
@@ -198,7 +198,7 @@ Target::Target(Project *project, Kit *k, _constructor_tag) :
return wdAspect->workingDirectory(&d->m_macroExpander).toString();
}
return QString();
});
}, false);
}
Target::~Target()