From 28222d3bd0f2bb4d7406c8b4182ef932d26b4843 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 26 Dec 2019 08:42:11 -0500 Subject: [PATCH] Use existing pcb filename for Save As where possible --- pcbnew/files.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 5950fad32b..8a91dcc9ae 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -315,8 +315,15 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id ) case ID_COPY_BOARD_AS: case ID_SAVE_BOARD_AS: { + wxString orig_name; + wxFileName::SplitPath( GetBoard()->GetFileName(), + nullptr, nullptr, &orig_name, nullptr ); + + if( orig_name.IsEmpty() ) + orig_name = _( "noname" ); + wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); - wxFileName fn( pro_dir, _( "noname" ), KiCadPcbFileExtension ); + wxFileName fn( pro_dir, orig_name, KiCadPcbFileExtension ); wxString filename = fn.GetFullPath(); if( AskSaveBoardFileName( this, &filename ) )