From 32bf88fa8e80e74c37176b4fb0976adc1a17651d Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sun, 31 Jan 2021 23:57:41 -0500 Subject: [PATCH] Point to the user template path by default in pl editor --- common/paths.cpp | 3 ++- pagelayout_editor/files.cpp | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/paths.cpp b/common/paths.cpp index eb7fb6f1dd..15db7c76cb 100644 --- a/common/paths.cpp +++ b/common/paths.cpp @@ -83,7 +83,7 @@ wxString PATHS::GetUserTemplatesPath() tmp.AppendDir( "template" ); - return tmp.GetPath(); + return tmp.GetPathWithSep(); } @@ -227,6 +227,7 @@ void PATHS::EnsureUserPathsExist() EnsurePathExists( GetUserPluginsPath() ); EnsurePathExists( GetUserPlugins3DPath() ); EnsurePathExists( GetUserScriptingPath() ); + EnsurePathExists( GetUserTemplatesPath() ); EnsurePathExists( GetDefaultUserProjectsPath() ); EnsurePathExists( GetDefaultUserSymbolsPath() ); EnsurePathExists( GetDefaultUserFootprintsPath() ); diff --git a/pagelayout_editor/files.cpp b/pagelayout_editor/files.cpp index 050c30c01f..f5ef45805b 100644 --- a/pagelayout_editor/files.cpp +++ b/pagelayout_editor/files.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -177,8 +178,10 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) case wxID_SAVEAS: { - wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString, - PageLayoutDescrFileWildcard(), wxFD_SAVE ); + wxString dir = PATHS::GetUserTemplatesPath(); + wxFileDialog openFileDialog( this, _( "Save As" ), dir, wxEmptyString, + PageLayoutDescrFileWildcard(), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( openFileDialog.ShowModal() == wxID_CANCEL ) return;