From ab875b72ec12cc0c3d5f22bae3ccdb76d28ac6ce Mon Sep 17 00:00:00 2001
From: Eike Ziller <eike.ziller@nokia.com>
Date: Fri, 11 May 2012 16:50:23 +0200
Subject: [PATCH] Add a CurrentProject::BuildPath variable.

Task-number: QTCREATORBUG-4885

Change-Id: I9098f42336b487626d181a677ac92db2382c3cfe
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
---
 src/plugins/projectexplorer/projectexplorer.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index acdd2fdf825..b67e2303cdc 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -161,6 +161,7 @@ bool debug = false;
 
 static const char kCurrentProjectPath[] = "CurrentProject:Path";
 static const char kCurrentProjectFilePath[] = "CurrentProject:FilePath";
+static const char kCurrentProjectBuildPath[] = "CurrentProject:BuildPath";
 
 namespace ProjectExplorer {
 
@@ -1028,6 +1029,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
         tr("Full path of the current project's main file, including file name."));
     vm->registerVariable(kCurrentProjectPath,
         tr("Full path of the current project's main file, excluding file name."));
+    vm->registerVariable(kCurrentProjectBuildPath,
+        tr("Full build path of the current project's active build configuration."));
     connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
             this, SLOT(updateVariable(QByteArray)));
 
@@ -1165,6 +1168,13 @@ void ProjectExplorerPlugin::updateVariable(const QByteArray &variable)
         } else {
             Core::VariableManager::instance()->remove(variable);
         }
+    } else if (variable == kCurrentProjectBuildPath) {
+        if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) {
+            Core::VariableManager::instance()->insert(variable,
+                                                      currentProject()->activeTarget()->activeBuildConfiguration()->buildDirectory());
+        } else {
+            Core::VariableManager::instance()->remove(variable);
+        }
     }
 }
 
-- 
GitLab