From f6263e01292c766e035341dcf6b655729e7d089c Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 16 Nov 2021 20:48:11 -0500 Subject: [PATCH] Erase library env vars if tables are not migrated Fixes https://gitlab.com/kicad/code/kicad/-/issues/9660 --- common/settings/settings_manager.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/common/settings/settings_manager.cpp b/common/settings/settings_manager.cpp index 6978b7a70f..76b4d1fb11 100644 --- a/common/settings/settings_manager.cpp +++ b/common/settings/settings_manager.cpp @@ -527,6 +527,31 @@ bool SETTINGS_MANAGER::MigrateIfNeeded() if( !traverser.GetErrors().empty() ) DisplayErrorMessage( nullptr, traverser.GetErrors() ); + // Remove any library configuration if we didn't choose to import + if( !m_migrateLibraryTables ) + { + COMMON_SETTINGS common; + wxString path = GetPathForSettingsFile( &common ); + common.LoadFromFile( path ); + + const std::vector libKeys = { + wxT( "KICAD6_SYMBOL_DIR" ), + wxT( "KICAD6_3DMODEL_DIR" ), + wxT( "KICAD6_FOOTPRINT_DIR" ), + + // Deprecated keys + wxT( "KICAD_PTEMPLATES" ), + wxT( "KISYS3DMOD" ), + wxT( "KISYSMOD" ), + wxT( "KICAD_SYMBOL_DIR" ), + }; + + for( const wxString& key : libKeys ) + common.m_Env.vars.erase( key ); + + common.SaveToFile( path ); + } + return true; }