Eagle Schematic Import: fixed imported libraries location

Standalone eeschema did not have the project path set when importing
a non-KiCad sheet. Due to this any libraries created during the import
were saved to the directory of eeschema executable instead of the actual
schematic directory.
This commit is contained in:
Maciej Suminski 2017-12-12 15:28:21 +01:00
parent 7665a839cd
commit 124c82f1cf
1 changed files with 9 additions and 0 deletions

View File

@ -661,6 +661,8 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
if( !AskToSaveChanges() )
return;
// Set the project location if none is set
bool setProject = Prj().GetProjectFullName().IsEmpty();
wxString path = wxPathOnly( Prj().GetProjectFullName() );
wxFileDialog dlg( this, _( "Import Schematic" ), path,
@ -670,6 +672,13 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( setProject )
{
wxFileName projectFn( dlg.GetPath() );
projectFn.SetExt( ProjectFileExtension );
Prj().SetProjectFullName( projectFn.GetFullPath() );
}
// For now there is only one import plugin
ImportFile( dlg.GetPath(), SCH_IO_MGR::SCH_EAGLE );
}