Use sys::remove instead of ::unlink in Session::remove_empty_sounds for portability
authorTim Mayberry <mojofunk@gmail.com>
Tue, 4 Sep 2007 09:01:31 +0000 (09:01 +0000)
committerTim Mayberry <mojofunk@gmail.com>
Tue, 4 Sep 2007 09:01:31 +0000 (09:01 +0000)
git-svn-id: svn://localhost/ardour2/trunk@2411 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/session.cc

index eab864623b6fd85affb970b2c373c93ed95b2358..ed696446ef0f06475e354311bbc35f8cd871a5c3 100644 (file)
@@ -3395,10 +3395,16 @@ Session::remove_empty_sounds ()
                        
                if (AudioFileSource::is_empty (*this, audio_file_path.to_string())) {
 
-                       unlink (audio_file_path.to_string().c_str());
-                       
-                       string peak_path = peak_path_from_audio_path (audio_file_path.to_string());
-                       unlink (peak_path.c_str());
+                       try
+                       {
+                               sys::remove (audio_file_path);
+                               const string peak_path = peak_path_from_audio_path (audio_file_path.to_string());
+                               sys::remove (peak_path);
+                       }
+                       catch (const sys::filesystem_error& err)
+                       {
+                               error << err.what() << endmsg; 
+                       }
                }
        }
 }