Modify Session::load_history for portability
git-svn-id: svn://localhost/ardour2/trunk@2433 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
bddb43a2bf
commit
cb34718b38
@ -2706,29 +2706,31 @@ Session::save_history (string snapshot_name)
|
|||||||
int
|
int
|
||||||
Session::restore_history (string snapshot_name)
|
Session::restore_history (string snapshot_name)
|
||||||
{
|
{
|
||||||
XMLTree tree;
|
XMLTree tree;
|
||||||
string xmlpath;
|
|
||||||
|
|
||||||
if (snapshot_name.empty()) {
|
if (snapshot_name.empty()) {
|
||||||
snapshot_name = _current_snapshot_name;
|
snapshot_name = _current_snapshot_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read xml */
|
const string xml_filename = snapshot_name + history_suffix;
|
||||||
xmlpath = _path + snapshot_name + ".history";
|
const sys::path xml_path = _session_dir->root_path() / xml_filename;
|
||||||
cerr << string_compose(_("Loading history from '%1'."), xmlpath) << endmsg;
|
|
||||||
|
|
||||||
if (access (xmlpath.c_str(), F_OK)) {
|
info << string_compose(_("Loading history from '%1'."), xml_path.to_string()) << endmsg;
|
||||||
info << string_compose (_("%1: no history file \"%2\" for this session."), _name, xmlpath) << endmsg;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tree.read (xmlpath)) {
|
if (!sys::exists (xml_path)) {
|
||||||
error << string_compose (_("Could not understand session history file \"%1\""), xmlpath) << endmsg;
|
info << string_compose (_("%1: no history file \"%2\" for this session."),
|
||||||
return -1;
|
_name, xml_path.to_string()) << endmsg;
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* replace history */
|
if (!tree.read (xml_path.to_string())) {
|
||||||
_history.clear();
|
error << string_compose (_("Could not understand session history file \"%1\""),
|
||||||
|
xml_path.to_string()) << endmsg;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace history
|
||||||
|
_history.clear();
|
||||||
|
|
||||||
for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) {
|
for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user