forked from qt-creator/qt-creator
ProjectExplorer: Expand run environment
... before passing it to the process. Fixes: QTCREATORBUG-33095 Change-Id: I2bbe9ed6205ae1a5b58736db86e064d5edc0b8b0 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -77,6 +77,15 @@ Utils::Environment EnvironmentAspect::environment() const
|
||||
return env;
|
||||
}
|
||||
|
||||
Environment EnvironmentAspect::expandedEnvironment(const Utils::MacroExpander &expander) const
|
||||
{
|
||||
Environment expandedEnv;
|
||||
environment().forEachEntry([&](const QString &key, const QString &value, bool) {
|
||||
expandedEnv.set(key, expander.expand(value));
|
||||
});
|
||||
return expandedEnv;
|
||||
}
|
||||
|
||||
Environment EnvironmentAspect::modifiedBaseEnvironment() const
|
||||
{
|
||||
QTC_ASSERT(m_base >= 0 && m_base < m_baseEnvironments.size(), return Environment());
|
||||
|
@@ -25,6 +25,7 @@ public:
|
||||
|
||||
// The environment including the user's modifications.
|
||||
Utils::Environment environment() const;
|
||||
Utils::Environment expandedEnvironment(const Utils::MacroExpander &expander) const;
|
||||
|
||||
// Environment including modifiers, but without explicit user changes.
|
||||
Utils::Environment modifiedBaseEnvironment() const;
|
||||
|
@@ -503,7 +503,7 @@ ProcessRunData RunConfiguration::runnable() const
|
||||
if (auto workingDirectoryAspect = aspect<WorkingDirectoryAspect>())
|
||||
r.workingDirectory = r.command.executable().withNewMappedPath(workingDirectoryAspect->workingDirectory());
|
||||
if (auto environmentAspect = aspect<EnvironmentAspect>())
|
||||
r.environment = environmentAspect->environment();
|
||||
r.environment = environmentAspect->expandedEnvironment(*macroExpander());
|
||||
if (m_runnableModifier)
|
||||
m_runnableModifier(r);
|
||||
|
||||
|
Reference in New Issue
Block a user