summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-09-09 10:05:13 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-09-09 10:05:13 +0000
commit9ae356550e54a0f5d3a2bf6c35ef7174f8c0d7b1 (patch)
treec00e9a6049b73522208bb7fae971aed8876736eb /libs/ardour/session_state.cc
parentcb34718b388a7a6aeaf6fff4e220a621f621b45d (diff)
Use sys::path and sys::rename in Session::rename_state for portability
git-svn-id: svn://localhost/ardour2/trunk@2434 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 7c4f8c918f..21c0405f21 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -525,12 +525,21 @@ Session::rename_state (string old_name, string new_name)
/* refuse to rename the current snapshot or the "main" one */
return;
}
-
- const string old_xml_path = _path + old_name + statefile_suffix;
- const string new_xml_path = _path + new_name + statefile_suffix;
- if (rename (old_xml_path.c_str(), new_xml_path.c_str()) != 0) {
- error << string_compose(_("could not rename snapshot %1 to %2"), old_name, new_name) << endmsg;
+ const string old_xml_filename = old_name + statefile_suffix;
+ const string new_xml_filename = new_name + statefile_suffix;
+
+ const sys::path old_xml_path = _session_dir->root_path() / old_xml_filename;
+ const sys::path new_xml_path = _session_dir->root_path() / new_xml_filename;
+
+ try
+ {
+ sys::rename (old_xml_path, new_xml_path);
+ }
+ catch (const sys::filesystem_error& err)
+ {
+ error << string_compose(_("could not rename snapshot %1 to %2 (%3)"),
+ old_name, new_name, err.what()) << endmsg;
}
}