7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-07 22:05:32 +00:00

Report errors when library is missing.

This commit is contained in:
Jeff Young 2025-01-29 20:22:18 +00:00
parent 4cf8274b2b
commit 8bdc7f108b
3 changed files with 29 additions and 4 deletions

View File

@ -63,6 +63,15 @@ void FP_LIB_TABLE_ROW::SetType( const wxString& aType )
}
bool FP_LIB_TABLE_ROW::LibraryExists() const
{
if( plugin )
return plugin->CanReadLibrary( GetFullURI() );
return false;
}
FP_LIB_TABLE::FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable ) :
LIB_TABLE( aFallBackTable )
{

View File

@ -67,6 +67,8 @@ public:
*/
void SetType( const wxString& aType ) override;
bool LibraryExists() const;
PCB_IO_MGR::PCB_FILE_T GetFileType() { return type; }
protected:

View File

@ -837,10 +837,10 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
if( !reportProgress( ii++, (int) board->Footprints().size(), progressDelta ) )
return false; // DRC cancelled
LIB_ID fpID = footprint->GetFPID();
wxString libName = fpID.GetLibNickname();
wxString fpName = fpID.GetLibItemName();
const LIB_TABLE_ROW* libTableRow = nullptr;
LIB_ID fpID = footprint->GetFPID();
wxString libName = fpID.GetLibNickname();
wxString fpName = fpID.GetLibItemName();
const FP_LIB_TABLE_ROW* libTableRow = nullptr;
if( libName.IsEmpty() )
{
@ -884,6 +884,20 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
continue;
}
else if( !libTableRow->LibraryExists() )
{
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_ISSUES ) )
{
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
msg.Printf( _( "The footprint library '%s' was not found." ),
libName );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint );
reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
}
continue;
}
auto cacheIt = libFootprintCache.find( fpID );
std::shared_ptr<FOOTPRINT> libFootprint;