From a1e8cc5e44b8ab4bb5e78ec4a6fe08615038c0ae Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 10 Apr 2015 13:15:34 +0200 Subject: Use only active target for guessing run environment Change-Id: Id7f9f299a22dabd350ac1e8279500cf1054210f8 Reviewed-by: Tobias Hunger --- plugins/autotest/testtreemodel.cpp | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 0040b4d903..732b229534 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -411,28 +411,16 @@ static void addProjectInformation(TestConfiguration *config, const QString &file // if we could not figure out the run configuration // try to use the run configuration of the parent project if (!hasDesktopTarget && targetProject && !targetFile.isEmpty()) { - QList rcs = target->runConfigurations(); - foreach (ProjectExplorer::RunConfiguration *rc, rcs) { - ProjectExplorer::LocalApplicationRunConfiguration *localRunConfiguration - = qobject_cast(rc); - if (localRunConfiguration) { - if (ProjectExplorer::ProjectNode *localRootProjectNode = targetProject->rootProjectNode()) { - QList localFileNodes = localRootProjectNode->fileNodes(); - if (localFileNodes.size()) { - if (localFileNodes.at(0)->path() - == targetProject->projectFilePath()) { - hasDesktopTarget = true; - workDir = Utils::FileUtils::normalizePathName( - localRunConfiguration->workingDirectory()); - ProjectExplorer::EnvironmentAspect *environmentAspect - = localRunConfiguration->extraAspect(); - env = environmentAspect->environment(); - guessedRunConfiguration = true; - break; - } - } - } - } + auto localRunConfiguration + = qobject_cast(target->activeRunConfiguration()); + if (localRunConfiguration) { + hasDesktopTarget = true; + workDir = Utils::FileUtils::normalizePathName( + localRunConfiguration->workingDirectory()); + ProjectExplorer::EnvironmentAspect *environmentAspect + = localRunConfiguration->extraAspect(); + env = environmentAspect->environment(); + guessedRunConfiguration = true; } } } -- cgit v1.2.1