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:
parent
9fae30162d
commit
b4fc78fc0d
|
@ -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
|
// Since this goes out to the native filesystem, we get platform differences (ie: MSW's
|
||||||
// case-insensitive filesystem) handled "for free".
|
// case-insensitive filesystem) handled "for free".
|
||||||
|
// Warning: footprint names frequently contain a point. So be careful when initializing
|
||||||
wxFileName footprintFile( aLibraryPath, aFootprintName );
|
// wxFileName, and use a CTOR with extension specified
|
||||||
footprintFile.SetExt( KiCadFootprintFileExtension );
|
wxFileName footprintFile( aLibraryPath, aFootprintName, KiCadFootprintFileExtension );
|
||||||
|
|
||||||
return footprintFile.Exists();
|
return footprintFile.Exists();
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ bool MODULE_EDITOR_TOOLS::Init()
|
||||||
ctxMenu.AddSeparator();
|
ctxMenu.AddSeparator();
|
||||||
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, SELECTION_CONDITIONS::ShowAlways );
|
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, SELECTION_CONDITIONS::ShowAlways );
|
||||||
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
|
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ int MODULE_EDITOR_TOOLS::CutCopyFootprint( const TOOL_EVENT& aEvent )
|
||||||
m_copiedModule.reset( new MODULE( *m_frame->GetBoard()->GetFirstModule() ) );
|
m_copiedModule.reset( new MODULE( *m_frame->GetBoard()->GetFirstModule() ) );
|
||||||
else
|
else
|
||||||
m_copiedModule.reset( m_frame->LoadFootprint( fpID ) );
|
m_copiedModule.reset( m_frame->LoadFootprint( fpID ) );
|
||||||
|
|
||||||
if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
|
if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
|
||||||
DeleteFootprint(aEvent );
|
DeleteFootprint(aEvent );
|
||||||
|
|
||||||
|
@ -238,12 +238,12 @@ int MODULE_EDITOR_TOOLS::ExportFootprint( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
LIB_ID fpID = m_frame->GetTreeFPID();
|
LIB_ID fpID = m_frame->GetTreeFPID();
|
||||||
MODULE* fp;
|
MODULE* fp;
|
||||||
|
|
||||||
if( !fpID.IsValid() )
|
if( !fpID.IsValid() )
|
||||||
fp = m_frame->GetBoard()->GetFirstModule();
|
fp = m_frame->GetBoard()->GetFirstModule();
|
||||||
else
|
else
|
||||||
fp = m_frame->LoadFootprint( fpID );
|
fp = m_frame->LoadFootprint( fpID );
|
||||||
|
|
||||||
m_frame->Export_Module( fp );
|
m_frame->Export_Module( fp );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
*/
|
*/
|
||||||
inline void SetClickHandler( CLICK_HANDLER aHandler )
|
inline void SetClickHandler( CLICK_HANDLER aHandler )
|
||||||
{
|
{
|
||||||
assert( !m_clickHandler );
|
wxASSERT( !m_clickHandler );
|
||||||
m_clickHandler = aHandler;
|
m_clickHandler = aHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public:
|
||||||
*/
|
*/
|
||||||
inline void SetCancelHandler( CANCEL_HANDLER aHandler )
|
inline void SetCancelHandler( CANCEL_HANDLER aHandler )
|
||||||
{
|
{
|
||||||
assert( !m_cancelHandler );
|
wxASSERT( !m_cancelHandler );
|
||||||
m_cancelHandler = aHandler;
|
m_cancelHandler = aHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public:
|
||||||
*/
|
*/
|
||||||
inline void SetFinalizeHandler( FINALIZE_HANDLER aHandler )
|
inline void SetFinalizeHandler( FINALIZE_HANDLER aHandler )
|
||||||
{
|
{
|
||||||
assert( !m_finalizeHandler );
|
wxASSERT( !m_finalizeHandler );
|
||||||
m_finalizeHandler = aHandler;
|
m_finalizeHandler = aHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue