13
0

Add Session::create_session_file_from_template method

git-svn-id: svn://localhost/ardour2/trunk@1870 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Tim Mayberry 2007-05-18 02:45:36 +00:00
parent 5f7f6e092a
commit 0b0c764f4c
2 changed files with 15 additions and 9 deletions

View File

@ -956,6 +956,7 @@ class Session : public PBD::StatefulDestructible
void initialize_start_and_end_locations(nframes_t start, nframes_t end); void initialize_start_and_end_locations(nframes_t start, nframes_t end);
bool create_session_file(); bool create_session_file();
bool create_session_file_from_template (const string& template_path);
nframes_t compute_initial_length (); nframes_t compute_initial_length ();

View File

@ -485,6 +485,19 @@ Session::create_session_file ()
return true; 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 int
Session::create (bool& new_session, string* mix_template, nframes_t initial_length) 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 */ /* check new_session so we don't overwrite an existing one */
if (mix_template) { if (mix_template) {
if(!create_session_file_from_template(*mix_template)) return -1;
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;
}
new_session = false; new_session = false;
return 0; return 0;
} }