diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 6677a418529..4bb59cab1b0 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -233,6 +233,8 @@ bool RunConfiguration::isEnabled() const QWidget *RunConfiguration::createConfigurationWidget() { + if (const auto wdAspect = aspect()) + wdAspect->setMacroExpanderProvider([this] { return &m_expander; }); Layouting::Form builder; for (BaseAspect *aspect : qAsConst(m_aspects)) { if (aspect->isVisible()) diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index ef10cbc618e..4f02850f15b 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -176,6 +176,8 @@ void WorkingDirectoryAspect::addToLayout(LayoutBuilder &builder) { QTC_CHECK(!m_chooser); m_chooser = new PathChooser; + if (m_expanderProvider) + m_chooser->setMacroExpander(m_expanderProvider()); m_chooser->setHistoryCompleter(settingsKey()); m_chooser->setExpectedKind(Utils::PathChooser::Directory); m_chooser->setPromptDialogTitle(tr("Select Working Directory")); @@ -291,6 +293,11 @@ void WorkingDirectoryAspect::setDefaultWorkingDirectory(const FilePath &defaultW } } +void WorkingDirectoryAspect::setMacroExpanderProvider(const MacroExpanderProvider &expanderProvider) +{ + m_expanderProvider = expanderProvider; +} + /*! \internal */ diff --git a/src/plugins/projectexplorer/runconfigurationaspects.h b/src/plugins/projectexplorer/runconfigurationaspects.h index 00b44ceabf9..e417f4ca28c 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.h +++ b/src/plugins/projectexplorer/runconfigurationaspects.h @@ -82,6 +82,7 @@ public: Utils::FilePath defaultWorkingDirectory() const; Utils::FilePath unexpandedWorkingDirectory() const; void setDefaultWorkingDirectory(const Utils::FilePath &defaultWorkingDirectory); + void setMacroExpanderProvider(const Utils::MacroExpanderProvider &expanderProvider); Utils::PathChooser *pathChooser() const; private: @@ -95,6 +96,7 @@ private: Utils::FilePath m_defaultWorkingDirectory; QPointer m_chooser; QPointer m_resetButton; + Utils::MacroExpanderProvider m_expanderProvider; }; class PROJECTEXPLORER_EXPORT ArgumentsAspect : public Utils::BaseAspect