From 49d3440529432e7f088b46adff521004ce4a5585 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sat, 23 Feb 2019 09:04:22 -0800 Subject: [PATCH] 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 --- kicad/prjconfig.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index 45b84faf51..bc3b49acb7 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -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() )