CADSTAR: look for the symbol library .csa file under different names.

This commit is contained in:
Alex Shvartzkop 2023-10-15 05:56:38 +03:00
parent 77eaf252e2
commit ace7cbddfe
1 changed files with 21 additions and 3 deletions

View File

@ -37,6 +37,7 @@
#include <sch_plugins/kicad/sch_sexpr_plugin.h> #include <sch_plugins/kicad/sch_sexpr_plugin.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <wx_filename.h> #include <wx_filename.h>
#include <wx/dir.h>
const wxString CADSTAR_SCH_ARCHIVE_PLUGIN::GetName() const const wxString CADSTAR_SCH_ARCHIVE_PLUGIN::GetName() const
@ -257,11 +258,28 @@ void CADSTAR_SCH_ARCHIVE_PLUGIN::ensureLoadedLibrary( const wxString& aLibraryPa
} }
else else
{ {
// If none specified, use // If none specified, look for the
// symbol.csa in same folder as the .lib // .csa file in same folder as the .lib
csafn = wxFileName( aLibraryPath ); csafn = wxFileName( aLibraryPath );
csafn.SetName( "symbol" );
csafn.SetExt( "csa" ); csafn.SetExt( "csa" );
if( !csafn.FileExists() )
{
csafn.SetName( "symbol" );
if( !csafn.FileExists() )
{
csafn = wxDir::FindFirst( csafn.GetPath(), wxS( "*.csa" ),
wxDIR_FILES | wxDIR_HIDDEN );
if( !csafn.FileExists() )
{
THROW_IO_ERROR( wxString::Format(
_( "Cannot find the .csa file corresponding to library '%s'." ),
aLibraryPath ) );
}
}
}
} }
if( aProperties && aProperties->count( "fplib" ) ) if( aProperties && aProperties->count( "fplib" ) )