diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index 4ca3e52f44..f245d28a46 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -1262,10 +1262,10 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath() // Build the absolute path of current output directory to preselect it in the file browser. std::function textResolver = - [&]( wxString* token ) -> bool - { - return m_parent->Schematic().ResolveTextVar( token, 0 ); - }; + [&]( wxString* token ) -> bool + { + return m_parent->Schematic().ResolveTextVar( token, 0 ); + }; wxString path = m_outputDirectoryName->GetValue(); path = ExpandTextVars( path, &textResolver, nullptr, &Prj() ); diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 006a29e392..971316eb51 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -461,7 +461,15 @@ void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event ) void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { // Build the absolute path of current output directory to preselect it in the file browser. - wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() ); + std::function textResolver = + [&]( wxString* token ) -> bool + { + return m_parent->GetBoard()->ResolveTextVar( token, 0 ); + }; + + wxString path = m_outputDirectoryName->GetValue(); + path = ExpandTextVars( path, &textResolver, nullptr, &Prj() ); + path = ExpandEnvVarSubstitutions( path, &Prj() ); path = Prj().AbsolutePath( path ); wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );