Prefer MRU path to LastImportExportPath for importing footprints.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15102
This commit is contained in:
Jeff Young 2023-07-09 21:38:58 +01:00
parent dfe7051171
commit db61fe03b3
3 changed files with 10 additions and 15 deletions

View File

@ -78,7 +78,7 @@ public:
int m_LibWidth;
wxString m_LastImportExportPath;
wxString m_LastExportPath;
wxString m_FootprintTextShownColumns;

View File

@ -47,7 +47,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
m_Use45Limit( true ),
m_ArcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ),
m_LibWidth( 250 ),
m_LastImportExportPath(),
m_LastExportPath(),
m_FootprintTextShownColumns()
{
m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS;
@ -83,7 +83,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
&m_LibrarySortMode, 0 ) );
m_params.emplace_back( new PARAM<wxString>( "system.last_import_export_path",
&m_LastImportExportPath, "" ) );
&m_LastExportPath, "" ) );
m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns",
&m_FootprintTextShownColumns, "0 1 2 3 4 5 6" ) );

View File

@ -236,18 +236,13 @@ FOOTPRINT* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T a
FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
{
wxString lastOpenedPathForLoading = m_mruPath;
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
if( !cfg->m_LastImportExportPath.empty() )
lastOpenedPathForLoading = cfg->m_LastImportExportPath;
wxFileName fn;
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
wxFileName fn;
if( aName != wxT("") )
fn = aName;
else
fn = getFootprintFilenameFromUser( this, lastOpenedPathForLoading );
fn = getFootprintFilenameFromUser( this, m_mruPath );
if( !fn.IsOk() )
return nullptr;
@ -261,7 +256,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
return nullptr;
}
m_mruPath = cfg->m_LastImportExportPath = fn.GetPath();
m_mruPath = fn.GetPath();
wxString footprintName;
IO_MGR::PCB_FILE_T fileType = detect_file_type( fp, fn.GetFullPath(), &footprintName );
@ -332,8 +327,8 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint )
fn.SetExt( KiCadFootprintFileExtension );
if( !cfg->m_LastImportExportPath.empty() )
fn.SetPath( cfg->m_LastImportExportPath );
if( !cfg->m_LastExportPath.empty() )
fn.SetPath( cfg->m_LastExportPath );
else
fn.SetPath( m_mruPath );
@ -344,7 +339,7 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint )
return;
fn = EnsureFileExtension( dlg.GetPath(), KiCadFootprintFileExtension );
cfg->m_LastImportExportPath = fn.GetPath();
cfg->m_LastExportPath = fn.GetPath();
try
{