Fix assertion in PROJECT::setProjectFullName for non-standard extensions

Several entry points (macOS file open, file history, project tree) can pass
paths with extensions other than .kicad_pro to the project loading pipeline.
SETTINGS_MANAGER::LoadProject only normalized .pro to .kicad_pro, leaving
other extensions like .kicad_sch or .kicad_pcb to trigger the assertion in
PROJECT::setProjectFullName.

Broaden the extension normalization in SETTINGS_MANAGER::LoadProject to
handle any non-.kicad_pro extension, and replace the assertion in
PROJECT::setProjectFullName with a warning log and forced correction as
defense-in-depth.

Fixes KICAD-NZT
This commit is contained in:
Seth Hillbrand
2026-02-15 21:38:33 -08:00
parent b31b513a11
commit fc52a4428f
2 changed files with 10 additions and 3 deletions
+7 -1
View File
@@ -157,7 +157,13 @@ void PROJECT::setProjectFullName( const wxString& aFullPathAndName )
wxASSERT( m_project_name.IsAbsolute() );
wxASSERT( m_project_name.GetExt() == FILEEXT::ProjectFileExtension );
if( m_project_name.GetExt() != FILEEXT::ProjectFileExtension )
{
wxLogWarning( wxT( "Project file has unexpected extension '%s', expected '%s'" ),
m_project_name.GetExt(),
wxString::FromUTF8( FILEEXT::ProjectFileExtension ) );
m_project_name.SetExt( FILEEXT::ProjectFileExtension );
}
}
}