From 1bce506552f574e0209f9d3d0ae031083b85547e Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Thu, 15 Dec 2016 10:27:24 +0100 Subject: [PATCH] Add macros for current run configurations executable Accessible by CurrentRun:Runnable:FilePath etc. Task-number: QTCREATORBUG-12201 Change-Id: Ia8cde111507d8fd755d43f935fd2d319dfb73a67 Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/projectexplorer.cpp | 13 +++++++++++++ .../projectexplorer/projectexplorerconstants.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index e5fd014e8d5..575279a8999 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1328,6 +1328,19 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er return QString(); }); + expander->registerFileVariables(Constants::VAR_CURRENTRUN_EXECUTABLE_PREFIX, + tr("The currently active run configuration's executable (if applicable)"), + [this]() -> QString { + if (Target *target = activeTarget()) { + if (RunConfiguration *rc = target->activeRunConfiguration()) { + if (rc->runnable().is()) + return rc->runnable().as().executable; + } + } + return QString(); + }, + true); + expander->registerVariable(Constants::VAR_CURRENTBUILD_TYPE, tr("The currently active build configuration's type."), [&]() -> QString { diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index 7be8911395e..e916b648e78 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -239,6 +239,7 @@ const char VAR_CURRENTKIT_ID[] = "CurrentKit:Id"; const char VAR_CURRENTBUILD_NAME[] = "CurrentBuild:Name"; const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type"; const char VAR_CURRENTRUN_NAME[] = "CurrentRun:Name"; +const char VAR_CURRENTRUN_EXECUTABLE_PREFIX[] = "CurrentRun:Executable"; const char VAR_CURRENTDEVICE_HOSTADDRESS[] = "CurrentDevice:HostAddress"; const char VAR_CURRENTDEVICE_SSHPORT[] = "CurrentDevice:SshPort"; const char VAR_CURRENTDEVICE_USERNAME[] = "CurrentDevice:UserName";