kicad manager: fix broken Rename file command.

From master branch.
This commit is contained in:
jean-pierre charras 2023-10-29 18:34:28 +01:00
parent 0df48f3002
commit c41cd75b62
1 changed files with 3 additions and 2 deletions

View File

@ -123,10 +123,11 @@ bool PROJECT_TREE_ITEM::Rename( const wxString& name, bool check )
if( newFile == GetFileName() )
return false;
// If required, prompt the user if the filename extension has changed:
wxString ext = PROJECT_TREE_PANE::GetFileExt( GetType() );
wxRegEx reg( wxT( "^.*\\" ) + ext + wxT( "$" ), wxRE_ICASE );
wxString full_ext = wxT( "." ) + ext;
if( check && !ext.IsEmpty() && !reg.Matches( newFile ) )
if( check && !ext.IsEmpty() && !newFile.EndsWith( full_ext ) )
{
wxMessageDialog dialog( m_parent, _( "Changing file extension will change file type.\n"
"Do you want to continue ?" ),