From fb593bd0c0bd079e2a412c6f85add508b7a38743 Mon Sep 17 00:00:00 2001 From: Stefan Date: Fri, 6 Jan 2023 00:08:56 +0100 Subject: [PATCH] check Eagle schematic to be in xml format before parsing --- .../sch_plugins/eagle/sch_eagle_plugin.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index 89966be3c8..d3e13dfc8f 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -434,12 +435,20 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema wxXmlDocument xmlDocument; wxFFileInputStream stream( m_filename.GetFullPath() ); - // read first line to check for legacy kicad sch file - wxTextInputStream text( stream ); - wxString line = text.ReadLine(); - if( line.StartsWith( wxT( "EESchema" ) ) ) + // check if this is an eagle XML file as we currently only support XML files, not binary files + wxString str; + + // open the file + wxTextFile tfile; + tfile.Open(aFileName); + + // read the first line + str = tfile.GetFirstLine(); + + if(!str.StartsWith(wxT("