ProjectExplorer: Add executable() accessor to RunConfiguration

Amends f6c276daf0, which was a quick fix for 4.9.

Change-Id: I94281af6a9a0d0bfe197ce836488f708d5bd677d
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-05-23 18:10:34 +02:00
parent b7755b18c3
commit a9d2e14dca
7 changed files with 36 additions and 18 deletions

View File

@@ -200,6 +200,12 @@ RunConfiguration::RunConfiguration(Target *target, Core::Id id)
for (const AspectFactory &factory : theAspectFactories)
m_aspects.append(factory(target));
m_executableGetter = [this] {
if (const auto executableAspect = aspect<ExecutableAspect>())
return executableAspect->executable();
return FileName();
};
}
RunConfiguration::~RunConfiguration() = default;
@@ -321,6 +327,16 @@ QVariantMap RunConfiguration::toMap() const
return map;
}
void RunConfiguration::setExecutableGetter(const RunConfiguration::ExecutableGetter &exeGetter)
{
m_executableGetter = exeGetter;
}
FileName RunConfiguration::executable() const
{
return m_executableGetter();
}
BuildTargetInfo RunConfiguration::buildTargetInfo() const
{
return target()->buildTarget(m_buildKey);
@@ -376,8 +392,7 @@ bool RunConfiguration::fromMap(const QVariantMap &map)
Runnable RunConfiguration::runnable() const
{
Runnable r;
if (auto executableAspect = aspect<ExecutableAspect>())
r.executable = executableAspect->executable().toString();
r.executable = executable().toString();
if (auto argumentsAspect = aspect<ArgumentsAspect>())
r.commandLineArguments = argumentsAspect->arguments(macroExpander());
if (auto workingDirectoryAspect = aspect<WorkingDirectoryAspect>())