summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-05-18 02:45:15 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-05-18 02:45:15 +0000
commitc7e404a1c0ee9af941a335e4bdd2f667b0c6317a (patch)
treefbb6667281688e0215ca6e5088d9c51f6880d02d /libs
parent1dd429ac358a928eba56f5e54ab86ccf450fbc61 (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/session_state.cc33
1 files changed, 6 insertions, 27 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index c2dfd12b49..fe48a92109 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -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 */
if (mix_template) {
- std::string in_path = *mix_template;
-
- ifstream in(in_path.c_str());
-
- if (in){
- string out_path = _path;
- out_path += _name;
- out_path += statefile_suffix;
-
- 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;
- return 0;
-
- } else {
- error << string_compose (_("Could not open %1 for writing mix template"), out_path)
- << endmsg;
- return -1;
- }
+
+ string out_path = _path + _name + statefile_suffix;
- } else {
- error << string_compose (_("Could not open mix template %1 for reading"), in_path)
+ 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;
+ return 0;
}
/* set initial start + end point */