diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index f79b680741..e1a1fe11da 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -379,7 +379,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() ) {