bool
SessionDirectory::create ()
{
- if (is_directory (m_root_path))
- {
- PBD::error << string_compose(_("Cannot create Session directory at path %1 as it already exists"), m_root_path.to_string()) << endmsg;
- return false;
- }
+ bool is_new = false;
vector<path> sub_dirs = sub_directories ();
for (vector<path>::const_iterator i = sub_dirs.begin(); i != sub_dirs.end(); ++i)
{
- if (!create_directories(*i))
+ try
{
- PBD::error << string_compose(_("Cannot create Session directory at path %1 Error: %2"), (*i).to_string(), g_strerror (errno)) << endmsg;
- return false;
+ if(create_directories(*i)) {
+ PBD::info << string_compose(_("Created Session directory at path %1"), (*i).to_string()) << endmsg;
+ is_new = true;
+ }
+ }
+ catch (PBD::sys::filesystem_error& ex)
+ {
+ // log the error
+ PBD::error << string_compose(_("Cannot create Session directory at path %1 Error: %2"), (*i).to_string(), ex.what()) << endmsg;
+
+ // and rethrow
+ throw ex;
}
}
- return true;
+ return is_new;
}
bool
return l_sound_path;
}
+const path
+SessionDirectory::midi_path () const
+{
+ // the new style sound directory
+ path l_midi_path(m_root_path);
+
+ l_midi_path /= interchange_dir_name;
+ l_midi_path /= basename(m_root_path);
+ l_midi_path /= midi_dir_name;
+
+ return l_midi_path;
+}
+
const path
SessionDirectory::peak_path () const
{
return path(m_root_path) /= dead_sound_dir_name;
}
+const path
+SessionDirectory::dead_midi_path () const
+{
+ return path(m_root_path) /= dead_midi_dir_name;
+}
+
const path
SessionDirectory::export_path () const
{
vector<path> tmp_paths;
tmp_paths.push_back ( sound_path () );
+ tmp_paths.push_back ( midi_path () );
tmp_paths.push_back ( peak_path () );
tmp_paths.push_back ( dead_sound_path () );
+ tmp_paths.push_back ( dead_midi_path () );
tmp_paths.push_back ( export_path () );
return tmp_paths;