Commit 2f3c5e7a authored by Jacobo Aragunde Perez's avatar Jacobo Aragunde Perez Committed by jean-pierre charras

Eeschema: fix Bug #1102381 <eeschema: -cache.lib file not created the first...

Eeschema: fix Bug #1102381 <eeschema: -cache.lib file not created the first time you save a schematic>
parent 273244a1
...@@ -166,7 +166,10 @@ void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event ) ...@@ -166,7 +166,10 @@ void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event )
break; break;
case ID_SAVE_ONE_SHEET_UNDER_NEW_NAME: case ID_SAVE_ONE_SHEET_UNDER_NEW_NAME:
SaveEEFile( NULL, true ); if( SaveEEFile( NULL, true ) )
{
CreateArchiveLibraryCacheFile();
}
break; break;
} }
} }
...@@ -377,10 +380,7 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent ) ...@@ -377,10 +380,7 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent )
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
SaveEEFile( screen ); SaveEEFile( screen );
wxString cachename = fn.GetName() + wxT( "-cache" ); CreateArchiveLibraryCacheFile();
fn.SetName( cachename );
fn.SetExt( SchematicLibraryFileExtension );
CreateArchiveLibrary( fn.GetFullPath() );
} }
......
...@@ -40,6 +40,21 @@ ...@@ -40,6 +40,21 @@
#include <protos.h> #include <protos.h>
#include <class_library.h> #include <class_library.h>
#include <sch_component.h> #include <sch_component.h>
#include <sch_sheet.h>
#include <wildcards_and_files_ext.h>
bool SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile()
{
wxFileName fn;
SCH_SCREENS ScreenList;
fn = ScreenList.GetFirst()->GetFileName();
fn.SetName( fn.GetName() + wxT( "-cache" ) );
fn.SetExt( SchematicLibraryFileExtension );
return CreateArchiveLibrary( fn.GetFullPath() );
}
bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName ) bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
......
...@@ -1167,6 +1167,15 @@ public: ...@@ -1167,6 +1167,15 @@ public:
*/ */
void LoadLibraries( void ); void LoadLibraries( void );
/**
* Function CreateArchiveLibraryCacheFile
* creates a library file with the name of the root document plus the '-cache' suffix,
* That file will contain all components used in the current schematic.
*
* @return True if the file was written successfully.
*/
bool CreateArchiveLibraryCacheFile( void );
/** /**
* Function CreateArchiveLibrary * Function CreateArchiveLibrary
* creates a library \a aFileName that contains all components used in the current schematic. * creates a library \a aFileName that contains all components used in the current schematic.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment