Use PBD::copy_file in Session::create() to copy the template file.

git-svn-id: svn://localhost/ardour2/trunk@1867 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Tim Mayberry 2007-05-18 02:45:15 +00:00
parent 1dd429ac35
commit c7e404a1c0

View file

@ -510,38 +510,17 @@ 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) {
std::string in_path = *mix_template;
ifstream in(in_path.c_str()); string out_path = _path + _name + statefile_suffix;
if (in){ if(!copy_file (*mix_template, out_path)) {
string out_path = _path; error << string_compose (_("Could not use session template %1 to create new session."), *mix_template)
out_path += _name; << endmsg;
out_path += statefile_suffix; return -1;
}
ofstream out(out_path.c_str());
if (out){
out << in.rdbuf();
// okay, session is set up. Treat like normal saved
// session from now on.
new_session = false; new_session = false;
return 0; return 0;
} else {
error << string_compose (_("Could not open %1 for writing mix template"), out_path)
<< endmsg;
return -1;
}
} else {
error << string_compose (_("Could not open mix template %1 for reading"), in_path)
<< endmsg;
return -1;
}
} }
/* set initial start + end point */ /* set initial start + end point */