kicad_plugin.cpp: fix incorrect detection of existing footprints in PCB_IO::FootprintExists(), when fp names contain a point.

Fixes: lp:1837221
https://bugs.launchpad.net/kicad/+bug/1837221
This commit is contained in:
jean-pierre charras 2019-07-19 18:15:23 +02:00
parent 9fae30162d
commit b4fc78fc0d
3 changed files with 10 additions and 10 deletions

View File

@ -2108,9 +2108,9 @@ bool PCB_IO::FootprintExists( const wxString& aLibraryPath, const wxString& aFoo
//
// Since this goes out to the native filesystem, we get platform differences (ie: MSW's
// case-insensitive filesystem) handled "for free".
wxFileName footprintFile( aLibraryPath, aFootprintName );
footprintFile.SetExt( KiCadFootprintFileExtension );
// Warning: footprint names frequently contain a point. So be careful when initializing
// wxFileName, and use a CTOR with extension specified
wxFileName footprintFile( aLibraryPath, aFootprintName, KiCadFootprintFileExtension );
return footprintFile.Exists();
}

View File

@ -114,7 +114,7 @@ bool MODULE_EDITOR_TOOLS::Init()
ctxMenu.AddSeparator();
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
return true;
}
@ -166,7 +166,7 @@ int MODULE_EDITOR_TOOLS::CutCopyFootprint( const TOOL_EVENT& aEvent )
m_copiedModule.reset( new MODULE( *m_frame->GetBoard()->GetFirstModule() ) );
else
m_copiedModule.reset( m_frame->LoadFootprint( fpID ) );
if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
DeleteFootprint(aEvent );
@ -238,12 +238,12 @@ int MODULE_EDITOR_TOOLS::ExportFootprint( const TOOL_EVENT& aEvent )
{
LIB_ID fpID = m_frame->GetTreeFPID();
MODULE* fp;
if( !fpID.IsValid() )
fp = m_frame->GetBoard()->GetFirstModule();
else
fp = m_frame->LoadFootprint( fpID );
m_frame->Export_Module( fp );
return 0;
}

View File

@ -73,7 +73,7 @@ public:
*/
inline void SetClickHandler( CLICK_HANDLER aHandler )
{
assert( !m_clickHandler );
wxASSERT( !m_clickHandler );
m_clickHandler = aHandler;
}
@ -93,7 +93,7 @@ public:
*/
inline void SetCancelHandler( CANCEL_HANDLER aHandler )
{
assert( !m_cancelHandler );
wxASSERT( !m_cancelHandler );
m_cancelHandler = aHandler;
}
@ -103,7 +103,7 @@ public:
*/
inline void SetFinalizeHandler( FINALIZE_HANDLER aHandler )
{
assert( !m_finalizeHandler );
wxASSERT( !m_finalizeHandler );
m_finalizeHandler = aHandler;
}