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:
+7
-1
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user