diff options
author | André Nusser <andre.nusser@googlemail.com> | 2015-10-12 12:27:28 +0200 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-10-21 23:28:44 -0400 |
commit | 67f557b1f4fd1f1ecd9d38f14d83a12a294cb455 (patch) | |
tree | 85f655e28c98f37d333b28206623585945e59e74 /libs/ardour | |
parent | e4570242f3bb36fbb899aab9389808c1886b4a58 (diff) |
Add overwrite option to save_template. (default = false)
Before it could not overwrite.
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/session.h | 2 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 054862ce8a..0a2cb786ce 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -459,7 +459,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop int save_as (SaveAs&); int save_state (std::string snapshot_name, bool pending = false, bool switch_to_snapshot = false, bool template_only = false); int restore_state (std::string snapshot_name); - int save_template (std::string template_name); + int save_template (std::string template_name, bool replace_existing = false); int save_history (std::string snapshot_name = ""); int restore_history (std::string snapshot_name); void remove_state (std::string snapshot_name); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 3ccc4d606f..036e023dff 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2102,7 +2102,7 @@ Session::XMLSourceFactory (const XMLNode& node) } int -Session::save_template (string template_name) +Session::save_template (string template_name, bool replace_existing) { if ((_state_of_the_state & CannotSave) || template_name.empty ()) { return -1; @@ -2128,10 +2128,10 @@ Session::save_template (string template_name) } if (!ARDOUR::Profile->get_trx()) { - if (Glib::file_test (template_dir_path, Glib::FILE_TEST_EXISTS)) { + if (!replace_existing && Glib::file_test (template_dir_path, Glib::FILE_TEST_EXISTS)) { warning << string_compose(_("Template \"%1\" already exists - new version not created"), template_dir_path) << endmsg; - return -1; + return -2; } if (g_mkdir_with_parents (template_dir_path.c_str(), 0755) != 0) { |