Fix sloppy path handling in migration for old color settings

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15964
This commit is contained in:
Jon Evans 2023-10-31 23:38:44 -04:00
parent c6c808a7fa
commit ab4d9bcb14
2 changed files with 8 additions and 1 deletions

View File

@ -254,6 +254,9 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
return true;
} );
// this bump shouldn't have happened; add a no-op migration to avoid future issues
registerMigration( 4, 5, []() { return true; } );
}
@ -320,9 +323,10 @@ bool COLOR_SETTINGS::migrateSchema0to1()
return true;
}
wxString filename = m_filename + wxT( "_footprints" );
wxString filename = GetFilename().BeforeLast( '.' ) + wxT( "_footprints" );
COLOR_SETTINGS* fpsettings = m_manager->AddNewColorSettings( filename );
fpsettings->SetLocation( GetLocation() );
// Start out with a clone
fpsettings->m_internals->CloneFrom( *m_internals );

View File

@ -109,6 +109,9 @@ JSON_SETTINGS::~JSON_SETTINGS()
wxString JSON_SETTINGS::GetFullFilename() const
{
if( m_filename.BeforeLast( '.' ) == getFileExt() )
return m_filename;
return wxString( m_filename + "." + getFileExt() );
}