Use PBD::sys::copy_file instead of PBD::copy_file in Session::remote_state
authorTim Mayberry <mojofunk@gmail.com>
Tue, 4 Sep 2007 04:48:21 +0000 (04:48 +0000)
committerTim Mayberry <mojofunk@gmail.com>
Tue, 4 Sep 2007 04:48:21 +0000 (04:48 +0000)
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

libs/ardour/session_state.cc

index 36f9b55c95f725833e6f7fe600228ab1b6e29e91..80c427076c4a21c5acb14efdeddb73080201fd08 100644 (file)
@@ -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);
 }