do not allow import of legacy kicad schematic via importer
This commit is contained in:
parent
13e79af8a0
commit
e6fd70777b
|
@ -30,8 +30,10 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
#include <wx/string.h>
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
#include <wx/wfstream.h>
|
#include <wx/wfstream.h>
|
||||||
|
#include <wx/txtstrm.h>
|
||||||
#include <wx/xml/xml.h>
|
#include <wx/xml/xml.h>
|
||||||
|
|
||||||
#include <symbol_library.h>
|
#include <symbol_library.h>
|
||||||
|
@ -432,6 +434,15 @@ 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() );
|
||||||
|
|
||||||
|
// read first line to check for legacy kicad sch file
|
||||||
|
wxTextInputStream text( stream );
|
||||||
|
wxString line = text.ReadLine();
|
||||||
|
if( line.StartsWith( wxT( "EESchema" ) ) )
|
||||||
|
{
|
||||||
|
THROW_IO_ERROR( wxString::Format( _( "'%s' is an legacy Kicad schematic format file. Try to open this file instead of importing it." ),
|
||||||
|
m_filename.GetFullPath() ) );
|
||||||
|
}
|
||||||
|
|
||||||
if( !stream.IsOk() || !xmlDocument.Load( stream ) )
|
if( !stream.IsOk() || !xmlDocument.Load( stream ) )
|
||||||
{
|
{
|
||||||
THROW_IO_ERROR( wxString::Format( _( "Unable to read file '%s'." ),
|
THROW_IO_ERROR( wxString::Format( _( "Unable to read file '%s'." ),
|
||||||
|
|
Loading…
Reference in New Issue