diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index e432de0e68..55616061c1 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -361,7 +361,16 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) wxString path = m_outputFileName->GetValue(); m_parent->SetLastPath( LAST_PATH_STEP, path ); + // Build the absolute path of current output directory to preselect it in the file browser. + std::function textResolver = + [&]( wxString* token ) -> bool + { + return m_parent->GetBoard()->ResolveTextVar( token, 0 ); + }; + + path = ExpandTextVars( path, &textResolver ); path = ExpandEnvVarSubstitutions( path, &Prj() ); + path = Prj().AbsolutePath( path ); if( path.IsEmpty() ) {