diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_plugin.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_plugin.cpp index 77f08d955b..9afcb5ef81 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_plugin.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_plugin.cpp @@ -37,6 +37,7 @@ #include #include #include +#include const wxString CADSTAR_SCH_ARCHIVE_PLUGIN::GetName() const @@ -257,11 +258,28 @@ void CADSTAR_SCH_ARCHIVE_PLUGIN::ensureLoadedLibrary( const wxString& aLibraryPa } else { - // If none specified, use - // symbol.csa in same folder as the .lib + // If none specified, look for the + // .csa file in same folder as the .lib csafn = wxFileName( aLibraryPath ); - csafn.SetName( "symbol" ); 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" ) )