Use only active target for guessing run environment

Change-Id: Id7f9f299a22dabd350ac1e8279500cf1054210f8
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Christian Stenger
2015-04-10 13:15:34 +02:00
parent 7768f07ece
commit a1e8cc5e44

View File

@@ -411,28 +411,16 @@ static void addProjectInformation(TestConfiguration *config, const QString &file
// if we could not figure out the run configuration // if we could not figure out the run configuration
// try to use the run configuration of the parent project // try to use the run configuration of the parent project
if (!hasDesktopTarget && targetProject && !targetFile.isEmpty()) { if (!hasDesktopTarget && targetProject && !targetFile.isEmpty()) {
QList<ProjectExplorer::RunConfiguration *> rcs = target->runConfigurations(); auto localRunConfiguration
foreach (ProjectExplorer::RunConfiguration *rc, rcs) { = qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(target->activeRunConfiguration());
ProjectExplorer::LocalApplicationRunConfiguration *localRunConfiguration if (localRunConfiguration) {
= qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(rc); hasDesktopTarget = true;
if (localRunConfiguration) { workDir = Utils::FileUtils::normalizePathName(
if (ProjectExplorer::ProjectNode *localRootProjectNode = targetProject->rootProjectNode()) { localRunConfiguration->workingDirectory());
QList<ProjectExplorer::FileNode *> localFileNodes = localRootProjectNode->fileNodes(); ProjectExplorer::EnvironmentAspect *environmentAspect
if (localFileNodes.size()) { = localRunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
if (localFileNodes.at(0)->path() env = environmentAspect->environment();
== targetProject->projectFilePath()) { guessedRunConfiguration = true;
hasDesktopTarget = true;
workDir = Utils::FileUtils::normalizePathName(
localRunConfiguration->workingDirectory());
ProjectExplorer::EnvironmentAspect *environmentAspect
= localRunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
env = environmentAspect->environment();
guessedRunConfiguration = true;
break;
}
}
}
}
} }
} }
} }