Prevent stripping preceived extensions from new proj

wxFilename automatically detects extensions based on the last "." in a
full filename.  We need to re-add the extension if it is removed.

Fixes: lp:1816862
* https://bugs.launchpad.net/kicad/+bug/1816862
This commit is contained in:
Seth Hillbrand 2019-02-23 09:04:22 -08:00
parent f002382b4a
commit 49d3440529
1 changed files with 6 additions and 0 deletions

View File

@ -229,6 +229,12 @@ void KICAD_MANAGER_FRAME::OnNewProject( wxCommandEvent& aEvent )
return;
wxFileName pro( dlg.GetPath() );
// wxFileName automatically extracts an extension. But if it isn't
// a .pro extension, we should keep it as part of the filename
if( pro.GetExt().ToStdString() != ProjectFileExtension )
pro.SetName( pro.GetName() + wxT( "." ) + pro.GetExt() );
pro.SetExt( ProjectFileExtension ); // enforce extension
if( !pro.IsAbsolute() )