diff options
-rw-r--r-- | libs/ardour/ardour/session.h | 3 | ||||
-rw-r--r-- | libs/ardour/session.cc | 4 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 16 |
3 files changed, 12 insertions, 11 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 13b1308641..5811efc234 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -951,7 +951,8 @@ class Session : public PBD::StatefulDestructible void update_latency_compensation (bool, bool); private: - int create (); + /// @return true in session directory was successfully created + bool create_session_directory (); void destroy (); void initialize_start_and_end_locations(nframes_t start, nframes_t end); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index bf777a73d9..30ac4b28c7 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -146,7 +146,7 @@ Session::Session (AudioEngine &eng, // to create a new session. assert(mix_template); - if (create () || + if (!create_session_directory () || !create_session_file_from_template (*mix_template)) { destroy (); throw failed_constructor (); @@ -221,7 +221,7 @@ Session::Session (AudioEngine &eng, initialize_start_and_end_locations(0, initial_length); if (g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) || - create () || + !create_session_directory () || !create_session_file ()) { destroy (); throw failed_constructor (); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index c41d7d742c..ccbb62b0dc 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -498,21 +498,21 @@ Session::create_session_file_from_template (const string& template_path) return true; } -int -Session::create () +bool +Session::create_session_directory () { string dir; if (g_mkdir_with_parents (_path.c_str(), 0755) < 0) { error << string_compose(_("Session: cannot create session dir \"%1\" (%2)"), _path, strerror (errno)) << endmsg; - return -1; + return false; } dir = peak_dir (); if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) { error << string_compose(_("Session: cannot create session peakfile dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg; - return -1; + return false; } /* if this is is an existing session with an old "sounds" directory, just use it. see Session::sound_dir() for more details */ @@ -523,7 +523,7 @@ Session::create () if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) { error << string_compose(_("Session: cannot create session sounds dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg; - return -1; + return false; } } @@ -531,17 +531,17 @@ Session::create () if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) { error << string_compose(_("Session: cannot create session dead sounds dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg; - return -1; + return false; } dir = export_dir (); if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) { error << string_compose(_("Session: cannot create session export dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg; - return -1; + return false; } - return 0; + return true; } int |