← Back to team overview

kicad-developers team mailing list archive

[PATCH] automatically add extension to sim workbook files

 

Hi,
at present, the simulator dialog saves workbook files without checking 
extensions, but only opens workbook files that have the .wbk extension. This 
makes it very easy to save files and not be able to open them (without some 
minor frustration). The attached patch checks the extension in the save file 
dialog and adds it if not present.

This is intended as a very gentle attempt to start contributing to kicad, and 
seeing if I have the patch format / commit messages etc correct.

Many thanks,
Dan W
>From 3d19ad6633b2db518419d7597a3d1dddae4b8698 Mon Sep 17 00:00:00 2001
From: Dan Weatherill <dan.weatherill@xxxxxxxxxx>
Date: Thu, 4 Jan 2018 19:28:54 +0000
Subject: [PATCH] automatically add extension to sim workbook files
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.13.6"

This is a multi-part message in MIME format.
--------------2.13.6
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


CHANGED: When a workbook file is saved from the simulation dialog
in eeschema, the extension is automatically added if it is not
specified. This behaviour is consistent with the workbook loading
dialog, which filters the filelist for only ".wbk" files with no
"all files" option.
---
 eeschema/sim/sim_plot_frame.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)


--------------2.13.6
Content-Type: text/x-patch; name="0001-automatically-add-extension-to-sim-workbook-files.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-automatically-add-extension-to-sim-workbook-files.patch"

diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp
index c7cb7bd80..8948b0cb0 100644
--- a/eeschema/sim/sim_plot_frame.cpp
+++ b/eeschema/sim/sim_plot_frame.cpp
@@ -706,7 +706,16 @@ bool SIM_PLOT_FRAME::loadWorkbook( const wxString& aPath )
 
 bool SIM_PLOT_FRAME::saveWorkbook( const wxString& aPath )
 {
-    wxTextFile file( aPath );
+    
+    wxString savePath = aPath;
+    
+    if(! aPath.EndsWith(".wbk"))
+    {
+        savePath += ".wbk";
+    };
+    
+    
+    wxTextFile file( savePath );
 
     if( file.Exists() )
     {

--------------2.13.6--


Attachment: signature.asc
Description: This is a digitally signed message part.


Follow ups