7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 19:33:44 +00:00

Optimize library migration

We don't need to re-validate the cache before saving each footprint.
This add a large time sink.  Instead, we only validate to ensure it
exists and then skip future validations while migrating

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18529
This commit is contained in:
Seth Hillbrand 2024-08-19 11:49:07 -07:00
parent 7214ef1f14
commit 3478492db3
2 changed files with 3 additions and 2 deletions
pcbnew/pcb_io

View File

@ -2876,7 +2876,7 @@ void PCB_IO_KICAD_SEXPR::FootprintSave( const wxString& aLibraryPath, const FOOT
// called for saving into a library path.
m_ctl = CTL_FOR_LIBRARY;
validateCache( aLibraryPath );
validateCache( aLibraryPath, !aProperties || !aProperties->contains( "skip_cache_validation" ) );
if( !m_cache->IsWritable() )
{

View File

@ -213,6 +213,7 @@ bool PCB_IO_MGR::ConvertLibrary( std::map<std::string, UTF8>* aOldFileProps, con
{
bool bestEfforts = false; // throw on first error
oldFilePI->FootprintEnumerate( fpNames, aOldFilePath, bestEfforts, aOldFileProps );
std::map<std::string, UTF8> props { { "skip_cache_validation", "" } };
for ( const wxString& fpName : fpNames )
{
@ -221,7 +222,7 @@ bool PCB_IO_MGR::ConvertLibrary( std::map<std::string, UTF8>* aOldFileProps, con
try
{
kicadPI->FootprintSave( aNewFilePath, fp.get() );
kicadPI->FootprintSave( aNewFilePath, fp.get(), &props );
}
catch( ... )
{