Fix starting path in worksheet selection dialog when using env vars

This commit is contained in:
Jon Evans 2022-10-25 22:08:28 -04:00
parent 01c69f1066
commit a01de6bf53
1 changed files with 8 additions and 3 deletions

View File

@ -21,6 +21,7 @@
#include <pgm_base.h> #include <pgm_base.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <base_screen.h> #include <base_screen.h>
#include <common.h> // ExpandEnvVarSubstitutions
#include <confirm.h> #include <confirm.h>
#include <core/arraydim.h> #include <core/arraydim.h>
#include <dialogs/dialog_page_settings.h> #include <dialogs/dialog_page_settings.h>
@ -773,16 +774,20 @@ void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog()
void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event ) void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
{ {
wxFileName fn = GetWksFileName(); wxFileName fn = GetWksFileName();
wxString name = GetWksFileName(); wxString name = fn.GetFullName();
wxString path; wxString path;
if( fn.IsAbsolute() ) if( fn.IsAbsolute() )
{ {
path = fn.GetPath(); path = fn.GetPath();
name = fn.GetFullName();
} }
else else
{ {
wxFileName expanded( ExpandEnvVarSubstitutions( GetWksFileName(), &m_parentFrame->Prj() ) );
if( expanded.IsAbsolute() )
path = expanded.GetPath();
else
path = m_projectPath; path = m_projectPath;
} }