From c41cd75b6282f011d9560210ea135de2ba660b92 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 29 Oct 2023 18:34:28 +0100 Subject: [PATCH] kicad manager: fix broken Rename file command. From master branch. --- kicad/project_tree_item.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kicad/project_tree_item.cpp b/kicad/project_tree_item.cpp index f29b42d39b..27f38b0369 100644 --- a/kicad/project_tree_item.cpp +++ b/kicad/project_tree_item.cpp @@ -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 ?" ),