Add a CurrentProject::BuildPath variable.

Task-number: QTCREATORBUG-4885

Change-Id: I9098f42336b487626d181a677ac92db2382c3cfe
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Eike Ziller
2012-05-11 16:50:23 +02:00
parent 82a821fc9b
commit ab875b72ec

View File

@@ -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);
}
}
}