Browse Source

Resolve textvars before opening file browser.

Fixes https://gitlab.com/kicad/code/kicad/issues/6436
7.0
Jeff Young 4 years ago
parent
commit
c3bed8f6ee
  1. 8
      eeschema/dialogs/dialog_plot_schematic.cpp
  2. 10
      pcbnew/dialogs/dialog_plot.cpp

8
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<bool( wxString* )> 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() );

10
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<bool( wxString* )> 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 );

Loading…
Cancel
Save