Use giomm in ARDOUR::create_backup_file to copy file for portablity

git-svn-id: svn://localhost/ardour2/branches/3.0@12846 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Tim Mayberry 2012-06-23 05:07:33 +00:00
parent 8cb88c8c2e
commit 28ca644274

View File

@ -20,6 +20,8 @@
#include <glibmm/fileutils.h>
#include <giomm/file.h>
#include "pbd/compose.h"
#include "pbd/error.h"
#include "pbd/file_utils.h"
@ -40,13 +42,14 @@ create_backup_file (const std::string & file_path)
{
if (!Glib::file_test (file_path, Glib::FILE_TEST_EXISTS)) return false;
std::string backup_path(file_path + backup_suffix);
Glib::RefPtr<Gio::File> backup_path = Gio::File::create_for_path(file_path + backup_suffix);
Glib::RefPtr<Gio::File> path = Gio::File::create_for_path(file_path);
try
{
sys::copy_file (file_path, backup_path);
path->copy (backup_path);
}
catch(sys::filesystem_error& ex)
catch(const Glib::Exception& ex)
{
error << string_compose (_("Unable to create a backup copy of file %1 (%2)"),
file_path, ex.what())