13
0

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
This commit is contained in:
Tim Mayberry 2007-09-09 10:05:13 +00:00
parent cb34718b38
commit 9ae356550e

View File

@ -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;
}
}