diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 70f496b0d9..0c8239eb54 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -21,6 +21,7 @@ #include #include #include +#include // ExpandEnvVarSubstitutions #include #include #include @@ -773,17 +774,21 @@ void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog() void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event ) { wxFileName fn = GetWksFileName(); - wxString name = GetWksFileName(); + wxString name = fn.GetFullName(); wxString path; if( fn.IsAbsolute() ) { path = fn.GetPath(); - name = fn.GetFullName(); } else { - path = m_projectPath; + wxFileName expanded( ExpandEnvVarSubstitutions( GetWksFileName(), &m_parentFrame->Prj() ) ); + + if( expanded.IsAbsolute() ) + path = expanded.GetPath(); + else + path = m_projectPath; } // Display a file picker dialog