From a06c4cac73db948ee4f6ee42b60b8f870d6d1c30 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 26 Apr 2023 18:14:55 +0200 Subject: [PATCH] SCH_IO_MGR::GuessPluginTypeFromLibPath() Ensure env vars are expanded in filename. For legacy libs ans cadstar libs the extension is .lib. So we need to read the header of the file, and therefore expand the env var inside the filename, if used. --- eeschema/sch_io_mgr.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_io_mgr.cpp b/eeschema/sch_io_mgr.cpp index 101ec4f958..602ce67c47 100644 --- a/eeschema/sch_io_mgr.cpp +++ b/eeschema/sch_io_mgr.cpp @@ -33,6 +33,7 @@ #include #include #include +#include // for ExpandEnvVarSubstitutions #define FMT_UNIMPLEMENTED _( "Plugin \"%s\" does not implement the \"%s\" function." ) #define FMT_NOTFOUND _( "Plugin type \"%s\" is not found." ) @@ -165,13 +166,15 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::GuessPluginTypeFromLibPath( const wxString& a // .lib is shared between CADSTAR and Legacy KiCad file formats. Let's read the header if( ext == LegacySymbolLibFileExtension ) { + wxString fullName = ExpandEnvVarSubstitutions( aLibPath, nullptr ); + for( SCH_FILE_T pluginType : { SCH_LEGACY, SCH_CADSTAR_ARCHIVE } ) { SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) ); if( pi ) { - if( pi->CheckHeader( aLibPath ) ) + if( pi->CheckHeader( fullName ) ) return pluginType; } }