Wayne, d'oh! OK, I have added the check in attached patch. We could avoid a string copy with some extra work, but I feel it's unnecessary for a filename.
Incidentally, I see a few memory leaks etc in here that could be fixed with unique_ptr usage. Is kicad now requiring c++11 and is this the kind of thing that is acceptable in a patch? THanks, Dan W On Thursday, 4 January 2018 20:02:10 GMT Wayne Stambaugh wrote: > Dan, > > Please make this case insensitive. Otherwise on case sensitive > platforms where someone has decided to use .Wbk, .WBK, etc. for the file > extension, your code doesn't add .wbk. > > Thanks, > > Wayne > > On 01/04/2018 02:37 PM, Dan Weatherill wrote: > > 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 > > > > > > > > _______________________________________________ > > Mailing list: https://launchpad.net/~kicad-developers > > Post to : [email protected] > > Unsubscribe : https://launchpad.net/~kicad-developers > > More help : https://help.launchpad.net/ListHelp > > _______________________________________________ > Mailing list: https://launchpad.net/~kicad-developers > Post to : [email protected] > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp
>From f629ff0a9c7cbaef05bcb558ba51a335765448f6 Mon Sep 17 00:00:00 2001 From: Dan Weatherill <[email protected]> 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..c8f617c68 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( !savePath.Lower().EndsWith(".wbk")) + { + savePath += ".wbk"; + }; + + + wxTextFile file( savePath ); if( file.Exists() ) { --------------2.13.6--
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

