summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-05-18 02:46:19 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-05-18 02:46:19 +0000
commitb8a14dff4972b8ccd3225dba5463ea7f78533417 (patch)
tree331f0099bcc5955b7168017e052fc2c01cc342f2 /libs
parent04c1ce19607eb04a1c5b306952e0c8e29f64525c (diff)
Use SessionDirectory class in place of Session::create_session_directory when creating a session from a template
git-svn-id: svn://localhost/ardour2/trunk@1875 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/session.cc35
1 files changed, 19 insertions, 16 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 3c43a70165..2570b8433d 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -124,32 +124,35 @@ Session::Session (AudioEngine &eng,
throw failed_constructor();
}
- cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (1)" << endl;
-
n_physical_outputs = _engine.n_physical_outputs();
n_physical_inputs = _engine.n_physical_inputs();
first_stage_init (fullpath, snapshot_name);
initialize_start_and_end_locations(0, compute_initial_length ());
-
- bool new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
- if (new_session) {
- // A mix_template must be specified if using this constructor
- // to create a new session.
- assert(mix_template);
+ SessionDirectory sdir(fullpath);
+
+ if (mix_template &&
+ sdir.create() &&
+ create_session_file_from_template (*mix_template)) {
- if (!create_session_directory () ||
- !create_session_file_from_template (*mix_template)) {
- destroy ();
- throw failed_constructor ();
- }
- // Continue construction like a normal saved session from now on.
- new_session = false;
+ cerr << "Creating session " << fullpath
+ <<" using template" << *mix_template
+ << endl;
+
+ } else if (sdir.is_valid ()) {
+
+ cerr << "Loading session " << fullpath
+ << " using snapshot " << snapshot_name << " (1)"
+ << endl;
+
+ } else {
+ destroy ();
+ throw failed_constructor ();
}
- if (second_stage_init (new_session)) {
+ if (second_stage_init (false)) {
destroy ();
throw failed_constructor ();
}