diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2007-09-04 04:48:21 +0000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2007-09-04 04:48:21 +0000 |
commit | 4535b6ae8499f747612bfd2a2272abc9a161bf7e (patch) | |
tree | 0a468851e7754f3bdf4bebe6e331d3a7b62c3888 /libs | |
parent | 96c9b5456f3eb99d28434d50947d5314f35d6b45 (diff) |
Use PBD::sys::copy_file instead of PBD::copy_file in Session::remote_state
Replace one line C style comments with C++ equivalent in Session::remove_state
git-svn-id: svn://localhost/ardour2/trunk@2378 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/session_state.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 36f9b55c95..80c427076c 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -541,7 +541,7 @@ void Session::remove_state (string snapshot_name) { if (snapshot_name == _current_snapshot_name || snapshot_name == _name) { - /* refuse to remove the current snapshot or the "main" one */ + // refuse to remove the current snapshot or the "main" one return; } @@ -551,12 +551,22 @@ Session::remove_state (string snapshot_name) sys::path backup_path(xml_path.to_string() + backup_suffix); - /* make a backup copy of the state file */ + // make a backup copy of the state file if (sys::exists (xml_path)) { - copy_file (xml_path.to_string(), backup_path.to_string()); + try + { + sys::copy_file (xml_path, backup_path); + } + catch(sys::filesystem_error& ex) + { + error << string_compose (_("Not removing state file %1 because a backup could not be made (%2)"), + xml_path.to_string(), ex.what()) + << endmsg; + return; + } } - /* and delete it */ + // and delete it sys::remove (xml_path); } |