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 );
std::string filename = wxString::Format( "%s_%02d",
loadedFilePath.GetName(),
getSheetNumber( rootSheetID ) ).ToStdString();
std::string filename = wxString::Format( "%s_%02d", loadedFilePath.GetName(),
getSheetNumber( rootSheetID ) )
.ToStdString();
ReplaceIllegalFileNameChars( &filename );
filename += wxT( "." ) + KiCadSchematicFileExtension;
@ -314,6 +314,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets()
m_sheetMap.insert( { rootSheetID, m_rootSheet } );
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
{
THROW_IO_ERROR( _( "The CADSTAR schematic might be corrupt: there is no root sheet." ) );