From 42a3cd8abe5eee7d98815f0cdde5f817793e883e Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Wed, 28 Oct 2009 17:36:39 +0100
Subject: [PATCH] Remove some duplicated code getting the builddirectory

---
 src/plugins/qt4projectmanager/makestep.cpp | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp
index bdb1bc4cc9c..7641c261b61 100644
--- a/src/plugins/qt4projectmanager/makestep.cpp
+++ b/src/plugins/qt4projectmanager/makestep.cpp
@@ -62,14 +62,10 @@ bool MakeStep::init(const QString &name)
     Environment environment = project()->environment(bc);
     setEnvironment(name, environment);
 
-    QString workingDirectory;
-    if (bc->value("useShadowBuild").toBool())
-        workingDirectory = bc->value("buildDirectory").toString();
-    if (workingDirectory.isEmpty())
-        workingDirectory = QFileInfo(project()->file()->fileName()).absolutePath();
+    Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
+    QString workingDirectory = qt4project->buildDirectory(bc);
     setWorkingDirectory(name, workingDirectory);
 
-    Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
     QString makeCmd = qt4project->makeCommand(bc);
     if (!value(name, "makeCmd").toString().isEmpty())
         makeCmd = value(name, "makeCmd").toString();
@@ -194,13 +190,9 @@ void MakeStepConfigWidget::updateMakeOverrideLabel()
 void MakeStepConfigWidget::updateDetails()
 {
     // TODO reduce heavy code duplication
-    QString workingDirectory;
     Qt4Project *pro = static_cast<Qt4Project *>(m_makeStep->project());
     ProjectExplorer::BuildConfiguration *bc = pro->buildConfiguration(m_buildConfiguration);
-    if (bc->value("useShadowBuild").toBool())
-        workingDirectory = bc->value("buildDirectory").toString();
-    if (workingDirectory.isEmpty())
-        workingDirectory = QFileInfo(pro->file()->fileName()).absolutePath();
+    QString workingDirectory = pro->buildDirectory(bc);
 
     QString makeCmd = pro->makeCommand(bc);
     if (!m_makeStep->value(m_buildConfiguration, "makeCmd").toString().isEmpty())
-- 
GitLab