Erase library env vars if tables are not migrated

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9660
This commit is contained in:
Jon Evans 2021-11-16 20:48:11 -05:00
parent 7760d3275d
commit f6263e0129
1 changed files with 25 additions and 0 deletions

View File

@ -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<wxString> 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;
}