Don't write library name to footprint files.

Fixes: lp:1772095
* https://bugs.launchpad.net/kicad/+bug/1772095
This commit is contained in:
Jeff Young 2018-05-19 00:56:38 +01:00
parent c5696738d2
commit 0bcfb2c7df
1 changed files with 21 additions and 0 deletions

View File

@ -663,6 +663,25 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString&
}
class LIBRARY_NAME_CLEARER
{
MODULE* m_module;
LIB_ID m_savedFPID;
public:
LIBRARY_NAME_CLEARER( MODULE* aModule )
{
m_module = aModule;
m_savedFPID = aModule->GetFPID();
m_module->SetFPID( LIB_ID( m_savedFPID.GetLibItemName() ) );
}
~LIBRARY_NAME_CLEARER()
{
m_module->SetFPID( m_savedFPID );
}
};
bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( wxString activeLibrary, MODULE* aModule )
{
if( aModule == NULL )
@ -777,6 +796,8 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( wxString activeLibrary, MODUL
module_exists = m != nullptr;
delete m;
LIBRARY_NAME_CLEARER temp( aModule );
// this always overwrites any existing footprint, but should yell on its
// own if the library or footprint is not writable.
tbl->FootprintSave( libraryName, aModule );