summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-12-19 14:46:15 +0100
committerRobin Gareus <robin@gareus.org>2015-12-19 14:46:15 +0100
commitd9eb5e00c52b40254afdc0f15dfe292b1b3753b6 (patch)
tree2607a578eef6b439987906a781a9128d6d0b127a /libs/ardour/session_state.cc
parentec9a8f022c8fad38a82b78823e6158676f621a34 (diff)
cont'd work on plugin-state templates - #6709
Refactor and consolidate code and re-use it for session-templates. This avoids recursive copying of the plugin-dir()
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc20
1 files changed, 6 insertions, 14 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index c440b77895..bde7208867 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -73,6 +73,7 @@
#include "pbd/stacktrace.h"
#include "pbd/convert.h"
#include "pbd/localtime_r.h"
+#include "pbd/unwind.h"
#include "ardour/amp.h"
#include "ardour/async_midi_port.h"
@@ -2161,25 +2162,16 @@ Session::save_template (string template_name, bool replace_existing)
XMLTree tree;
- tree.set_root (&get_template());
+ {
+ PBD::Unwinder<std::string> uw (_template_state_dir, template_dir_path);
+ tree.set_root (&get_template());
+ }
+
if (!tree.write (template_file_path)) {
error << _("template not saved") << endmsg;
return -1;
}
- if (!ARDOUR::Profile->get_trx()) {
- /* copy plugin state directory */
-
- std::string template_plugin_state_path (Glib::build_filename (template_dir_path, X_("plugins")));
-
- if (g_mkdir_with_parents (template_plugin_state_path.c_str(), 0755) != 0) {
- error << string_compose(_("Could not create directory for Session template plugin state\"%1\" (%2)"),
- template_plugin_state_path, g_strerror (errno)) << endmsg;
- return -1;
- }
- copy_files (plugins_dir(), template_plugin_state_path);
- }
-
store_recent_templates (template_file_path);
return 0;