From 0b0c764f4c11a9e350eb5f512bd203ca461d0e5b Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Fri, 18 May 2007 02:45:36 +0000 Subject: [PATCH] Add Session::create_session_file_from_template method git-svn-id: svn://localhost/ardour2/trunk@1870 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/session.h | 1 + libs/ardour/session_state.cc | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a381802796..237d7708e9 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -956,6 +956,7 @@ class Session : public PBD::StatefulDestructible void initialize_start_and_end_locations(nframes_t start, nframes_t end); bool create_session_file(); + bool create_session_file_from_template (const string& template_path); nframes_t compute_initial_length (); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index c8623980df..4c3e4d2dc0 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -485,6 +485,19 @@ Session::create_session_file () return true; } +bool +Session::create_session_file_from_template (const string& template_path) +{ + string out_path = _path + _name + statefile_suffix; + + if(!copy_file (template_path, out_path)) { + error << string_compose (_("Could not use session template %1 to create new session."), template_path) + << endmsg; + return false; + } + return true; +} + int Session::create (bool& new_session, string* mix_template, nframes_t initial_length) { @@ -532,15 +545,7 @@ Session::create (bool& new_session, string* mix_template, nframes_t initial_leng /* check new_session so we don't overwrite an existing one */ if (mix_template) { - - string out_path = _path + _name + statefile_suffix; - - if(!copy_file (*mix_template, out_path)) { - error << string_compose (_("Could not use session template %1 to create new session."), *mix_template) - << endmsg; - return -1; - } - + if(!create_session_file_from_template(*mix_template)) return -1; new_session = false; return 0; }