From 0365c5cc47f5f7c875714049f58f3a71cc53bdf7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 8 May 2015 11:58:23 -0400 Subject: [PATCH] Tracks-specific handling of template dir --- libs/ardour/session_state.cc | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index a217db5c45..4651de7286 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -490,7 +490,7 @@ Session::create (const string& session_template, BusProfile* bus_profile) _writable = exists_and_writable (_path); if (!session_template.empty()) { - std::string in_path = session_template_dir_to_file (session_template); + std::string in_path = (ARDOUR::Profile->get_trx () ? session_template : session_template_dir_to_file (session_template)); ifstream in(in_path.c_str()); @@ -2022,24 +2022,31 @@ Session::save_template (string template_name) template_dir_path = template_name; } - if (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; - } - - if (g_mkdir_with_parents (template_dir_path.c_str(), 0755) != 0) { - error << string_compose(_("Could not create directory for Session template\"%1\" (%2)"), - template_dir_path, g_strerror (errno)) << endmsg; - return -1; + if (!ARDOUR::Profile->get_trx()) { + if (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; + } + + if (g_mkdir_with_parents (template_dir_path.c_str(), 0755) != 0) { + error << string_compose(_("Could not create directory for Session template\"%1\" (%2)"), + template_dir_path, g_strerror (errno)) << endmsg; + return -1; + } } /* file to write */ std::string template_file_path; - if (absolute_path) { - template_file_path = Glib::build_filename (template_dir_path, Glib::path_get_basename (template_dir_path) + template_suffix); + + if (ARDOUR::Profile->get_trx()) { + template_file_path = template_name; } else { - template_file_path = Glib::build_filename (template_dir_path, template_name + template_suffix); + if (absolute_path) { + template_file_path = Glib::build_filename (template_dir_path, Glib::path_get_basename (template_dir_path) + template_suffix); + } else { + template_file_path = Glib::build_filename (template_dir_path, template_name + template_suffix); + } } SessionSaveUnderway (); /* EMIT SIGNAL */ -- 2.30.2