Special case cadstar libraries when error reporting.

This commit is contained in:
Roberto Fernandez Bautista 2023-02-25 22:52:39 +01:00
parent f45ab30fa6
commit 7a6b64d371
1 changed files with 8 additions and 3 deletions

View File

@ -302,9 +302,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets()
wxFileName loadedFilePath = wxFileName( Filename ); wxFileName loadedFilePath = wxFileName( Filename );
std::string filename = wxString::Format( "%s_%02d", std::string filename = wxString::Format( "%s_%02d", loadedFilePath.GetName(),
loadedFilePath.GetName(), getSheetNumber( rootSheetID ) )
getSheetNumber( rootSheetID ) ).ToStdString(); .ToStdString();
ReplaceIllegalFileNameChars( &filename ); ReplaceIllegalFileNameChars( &filename );
filename += wxT( "." ) + KiCadSchematicFileExtension; filename += wxT( "." ) + KiCadSchematicFileExtension;
@ -314,6 +314,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets()
m_sheetMap.insert( { rootSheetID, m_rootSheet } ); m_sheetMap.insert( { rootSheetID, m_rootSheet } );
loadChildSheets( rootSheetID, rootPath ); loadChildSheets( rootSheetID, rootPath );
} }
else if( Header.Format.Type == "SYMBOL" )
{
THROW_IO_ERROR( _( "The selected file is a CADSTAR symbol library. It does not contain a "
"schematic design so cannot be imported/opened in this way." ) );
}
else else
{ {
THROW_IO_ERROR( _( "The CADSTAR schematic might be corrupt: there is no root sheet." ) ); THROW_IO_ERROR( _( "The CADSTAR schematic might be corrupt: there is no root sheet." ) );