13
0

Rename Session::create to Session::create_session_directory and use bool to indicate success/failure

git-svn-id: svn://localhost/ardour2/trunk@1872 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Tim Mayberry 2007-05-18 02:45:56 +00:00
parent 944601ec2d
commit e88f2f2e2f
3 changed files with 12 additions and 11 deletions

View File

@ -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);

View File

@ -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 ();

View File

@ -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