From 9ca1bf63d95d421608dc498d68fd8279aba0aa02 Mon Sep 17 00:00:00 2001 From: Mark Roszko Date: Mon, 1 Sep 2025 01:14:25 +0000 Subject: [PATCH] jobsets: fix Replace button to overwrite existing files (#19900) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 5fb55ccb30198c4b4e5eeea7a31b006769cc94d7) 1ea009e6 jobsets: allow replacing existing jobset files Co-authored-by: Adrián García --- kicad/tools/kicad_manager_control.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kicad/tools/kicad_manager_control.cpp b/kicad/tools/kicad_manager_control.cpp index 8845fefbf0..fe137a2fcd 100644 --- a/kicad/tools/kicad_manager_control.cpp +++ b/kicad/tools/kicad_manager_control.cpp @@ -224,6 +224,18 @@ int KICAD_MANAGER_CONTROL::NewJobsetFile( const TOOL_EVENT& aEvent ) wxFileName jobsetFn( dlg.GetPath() ); + // Check if the file already exists + bool fileExists = wxFileExists( jobsetFn.GetFullPath() ); + + if( fileExists ) + { + // Remove the existing file so that a new one can be created + if( !wxRemoveFile( jobsetFn.GetFullPath() ) ) + { + return -1; + } + } + m_frame->OpenJobsFile( jobsetFn.GetFullPath(), true ); return 0;