Browse Source

Eeschema: Determine file plugin to use from first line of file.

pull/5/merge
Russell Oliver 9 years ago
committed by Maciej Suminski
parent
commit
7ea33f76b4
  1. 25
      eeschema/files-io.cpp

25
eeschema/files-io.cpp

@ -315,7 +315,30 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
delete g_RootSheet; // Delete the current project.
g_RootSheet = NULL; // Force CreateScreens() to build new empty project on load failure.
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ) );
// Open file and guess at filetype Kicad/Eagle
wxTextFile tempFile;
tempFile.Open( fullFileName );
wxString firstline;
// read the first line
firstline = tempFile.GetFirstLine();
tempFile.Close();
SCH_IO_MGR::SCH_FILE_T filetype;
if( firstline.StartsWith( "<?xml" ) )
{
filetype = SCH_IO_MGR::SCH_EAGLE;
}
else if( firstline.StartsWith( "(schematic" ) )
{
filetype = SCH_IO_MGR::SCH_KICAD;
}
else
{
filetype = SCH_IO_MGR::SCH_LEGACY;
}
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( filetype ) );
try
{

Loading…
Cancel
Save