fix used functions

This commit is contained in:
Stefan 2023-01-07 11:08:56 +01:00 committed by Jeff Young
parent 34700c00f6
commit 992f38a6ce
1 changed files with 4 additions and 13 deletions

View File

@ -30,8 +30,6 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/string.h>
#include <wx/textfile.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include <wx/txtstrm.h> #include <wx/txtstrm.h>
@ -435,17 +433,10 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema
wxXmlDocument xmlDocument; wxXmlDocument xmlDocument;
wxFFileInputStream stream( m_filename.GetFullPath() ); wxFFileInputStream stream( m_filename.GetFullPath() );
// check if this is an eagle XML file as we currently only support XML files, not binary files // read first line to check for Eagle XML format file
wxString str; wxTextInputStream text( stream );
wxString line = text.ReadLine();
// open the file if( !line.StartsWith( wxT( "<?xml" ) ) )
wxTextFile tfile;
tfile.Open(aFileName);
// read the first line
str = tfile.GetFirstLine();
if(!str.StartsWith(wxT("<?xml")))
{ {
THROW_IO_ERROR( wxString::Format( _( "'%s' is an Eagle binary-format schematic file; " THROW_IO_ERROR( wxString::Format( _( "'%s' is an Eagle binary-format schematic file; "
"only Eagle XML-format schematics can be imported." ), "only Eagle XML-format schematics can be imported." ),