diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 12bc2ac3095..27d08acb803 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -192,7 +192,7 @@ public: EnvironmentChange m_environmentChange; BinaryVersionToolTipEventFilter *m_binaryVersionToolTipEventFilter = nullptr; QList m_buttons; - MacroExpander *m_macroExpander = globalMacroExpander(); + const MacroExpander *m_macroExpander = globalMacroExpander(); std::function m_openTerminal; }; @@ -732,7 +732,7 @@ void PathChooser::setHistoryCompleter(const QString &historyKey, bool restoreLas d->m_lineEdit->setHistoryCompleter(historyKey, restoreLastItemFromHistory); } -void PathChooser::setMacroExpander(MacroExpander *macroExpander) +void PathChooser::setMacroExpander(const MacroExpander *macroExpander) { d->m_macroExpander = macroExpander; } diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index 6e1760d3914..698dc48951a 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -136,7 +136,7 @@ public: // Sets a macro expander that is used when producing path and fileName. // By default, the global expander is used. // nullptr can be passed to disable macro expansion. - void setMacroExpander(MacroExpander *macroExpander); + void setMacroExpander(const MacroExpander *macroExpander); bool isReadOnly() const; void setReadOnly(bool b); diff --git a/src/plugins/baremetal/baremetalrunconfiguration.cpp b/src/plugins/baremetal/baremetalrunconfiguration.cpp index 8cfc8378641..f081520bebb 100644 --- a/src/plugins/baremetal/baremetalrunconfiguration.cpp +++ b/src/plugins/baremetal/baremetalrunconfiguration.cpp @@ -53,7 +53,7 @@ public: exeAspect->setPlaceHolderText(tr("Unknown")); addAspect(macroExpander()); - addAspect(nullptr); + addAspect(macroExpander(), nullptr); setUpdater([this, exeAspect] { const BuildTargetInfo bti = buildTargetInfo(); @@ -80,7 +80,7 @@ public: exeAspect->setExpectedKind(PathChooser::Any); addAspect(macroExpander()); - addAspect(nullptr); + addAspect(macroExpander(), nullptr); setDefaultDisplayName(RunConfigurationFactory::decoratedTargetName(tr("Custom Executable"), target)); } diff --git a/src/plugins/boot2qt/qdbrunconfiguration.cpp b/src/plugins/boot2qt/qdbrunconfiguration.cpp index 5706116445d..98cae5734bc 100644 --- a/src/plugins/boot2qt/qdbrunconfiguration.cpp +++ b/src/plugins/boot2qt/qdbrunconfiguration.cpp @@ -102,7 +102,7 @@ QdbRunConfiguration::QdbRunConfiguration(Target *target, Id id) auto envAspect = addAspect(target); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); addAspect(this); setUpdater([this, target, exeAspect, symbolsAspect] { diff --git a/src/plugins/mesonprojectmanager/project/mesonrunconfiguration.cpp b/src/plugins/mesonprojectmanager/project/mesonrunconfiguration.cpp index cdba329df92..84f226ab6f7 100644 --- a/src/plugins/mesonprojectmanager/project/mesonrunconfiguration.cpp +++ b/src/plugins/mesonprojectmanager/project/mesonrunconfiguration.cpp @@ -46,7 +46,7 @@ MesonRunConfiguration::MesonRunConfiguration(ProjectExplorer::Target *target, Ut addAspect(target); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); addAspect(); auto libAspect = addAspect(); diff --git a/src/plugins/nim/project/nimblerunconfiguration.cpp b/src/plugins/nim/project/nimblerunconfiguration.cpp index 8ff42f1aef7..e88e2c11ad6 100644 --- a/src/plugins/nim/project/nimblerunconfiguration.cpp +++ b/src/plugins/nim/project/nimblerunconfiguration.cpp @@ -54,7 +54,7 @@ public: auto envAspect = addAspect(target); addAspect(target); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); addAspect(); setUpdater([this] { @@ -91,7 +91,8 @@ public: { addAspect(target)->setExecutable(Nim::nimblePathFromKit(target->kit())); addAspect(macroExpander())->setArguments("test"); - addAspect(nullptr)->setDefaultWorkingDirectory(project()->projectDirectory()); + addAspect(macroExpander(), nullptr) + ->setDefaultWorkingDirectory(project()->projectDirectory()); addAspect(); setDisplayName(tr("Nimble Test")); diff --git a/src/plugins/nim/project/nimrunconfiguration.cpp b/src/plugins/nim/project/nimrunconfiguration.cpp index 1e5e519548e..925fac47736 100644 --- a/src/plugins/nim/project/nimrunconfiguration.cpp +++ b/src/plugins/nim/project/nimrunconfiguration.cpp @@ -52,7 +52,7 @@ public: auto envAspect = addAspect(target); addAspect(target); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); addAspect(); setDisplayName(tr("Current Build Target")); diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 67cdaa2965a..cbd8705f6ff 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -53,7 +53,7 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *targe exeAspect->setEnvironmentChange(EnvironmentChange::fromFixedEnvironment(envAspect->environment())); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); addAspect(); connect(envAspect, &EnvironmentAspect::environmentChanged, this, [exeAspect, envAspect] { diff --git a/src/plugins/projectexplorer/desktoprunconfiguration.cpp b/src/plugins/projectexplorer/desktoprunconfiguration.cpp index cef277f53f3..663474afdc5 100644 --- a/src/plugins/projectexplorer/desktoprunconfiguration.cpp +++ b/src/plugins/projectexplorer/desktoprunconfiguration.cpp @@ -70,7 +70,7 @@ DesktopRunConfiguration::DesktopRunConfiguration(Target *target, Id id, Kind kin addAspect(target); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); addAspect(); auto libAspect = addAspect(); diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 22a4e3a99ef..ab2e00e7440 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -171,8 +171,9 @@ bool TerminalAspect::isUserSet() const working directory for running the executable. */ -WorkingDirectoryAspect::WorkingDirectoryAspect(EnvironmentAspect *envAspect) - : m_envAspect(envAspect) +WorkingDirectoryAspect::WorkingDirectoryAspect(const MacroExpander *expander, + EnvironmentAspect *envAspect) + : m_envAspect(envAspect), m_macroExpander(expander) { setDisplayName(tr("Working Directory")); setId("WorkingDirectoryAspect"); diff --git a/src/plugins/projectexplorer/runconfigurationaspects.h b/src/plugins/projectexplorer/runconfigurationaspects.h index 3c5058d40de..768d89a0430 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.h +++ b/src/plugins/projectexplorer/runconfigurationaspects.h @@ -81,7 +81,8 @@ class PROJECTEXPLORER_EXPORT WorkingDirectoryAspect : public Utils::BaseAspect Q_OBJECT public: - explicit WorkingDirectoryAspect(EnvironmentAspect *envAspect); + explicit WorkingDirectoryAspect(const Utils::MacroExpander *expander, + EnvironmentAspect *envAspect); void addToLayout(Utils::LayoutBuilder &builder) override; @@ -102,7 +103,7 @@ private: Utils::FilePath m_defaultWorkingDirectory; QPointer m_chooser; QPointer m_resetButton; - Utils::MacroExpander *m_macroExpander = nullptr; + const Utils::MacroExpander *m_macroExpander = nullptr; }; class PROJECTEXPLORER_EXPORT ArgumentsAspect : public Utils::BaseAspect diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index cb5cb948cb5..12813f6829b 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -178,7 +178,7 @@ public: auto argumentsAspect = addAspect(macroExpander()); - addAspect(nullptr); + addAspect(macroExpander(), nullptr); addAspect(); setCommandLineGetter([bufferedAspect, interpreterAspect, argumentsAspect, scriptAspect] { diff --git a/src/plugins/qnx/qnxrunconfiguration.cpp b/src/plugins/qnx/qnxrunconfiguration.cpp index 88535ebd41d..39753f8afb4 100644 --- a/src/plugins/qnx/qnxrunconfiguration.cpp +++ b/src/plugins/qnx/qnxrunconfiguration.cpp @@ -61,7 +61,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Id id) auto envAspect = addAspect(target); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); addAspect(); auto libAspect = addAspect(); diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index 51edcf7efea..6009c502696 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -72,7 +72,7 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar symbolsAspect->setDisplayStyle(SymbolFileAspect::PathChooserDisplay); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); if (HostOsInfo::isAnyUnixHost()) addAspect(); if (HostOsInfo::isAnyUnixHost()) diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index a0cccf4f6ef..44d1c677281 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -71,7 +71,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id) symbolsAspect->setDisplayStyle(SymbolFileAspect::LabelDisplay); addAspect(macroExpander()); - addAspect(envAspect); + addAspect(macroExpander(), envAspect); if (HostOsInfo::isAnyUnixHost()) addAspect(); if (HostOsInfo::isAnyUnixHost())