summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-09-09 10:05:06 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-09-09 10:05:06 +0000
commitcb34718b388a7a6aeaf6fff4e220a621f621b45d (patch)
tree3ec729e24c45487d1a4d8ea6aae8508816825273 /libs/ardour/session_state.cc
parentbddb43a2bfdb21ac9f2b80a39b90336a7aaf2b87 (diff)
Modify Session::load_history for portability
git-svn-id: svn://localhost/ardour2/trunk@2433 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc38
1 files changed, 20 insertions, 18 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 77a8061377..7c4f8c918f 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -2706,29 +2706,31 @@ Session::save_history (string snapshot_name)
int
Session::restore_history (string snapshot_name)
{
- XMLTree tree;
- string xmlpath;
+ XMLTree tree;
- if (snapshot_name.empty()) {
- snapshot_name = _current_snapshot_name;
- }
+ if (snapshot_name.empty()) {
+ snapshot_name = _current_snapshot_name;
+ }
- /* read xml */
- xmlpath = _path + snapshot_name + ".history";
- cerr << string_compose(_("Loading history from '%1'."), xmlpath) << endmsg;
+ const string xml_filename = snapshot_name + history_suffix;
+ const sys::path xml_path = _session_dir->root_path() / xml_filename;
- if (access (xmlpath.c_str(), F_OK)) {
- info << string_compose (_("%1: no history file \"%2\" for this session."), _name, xmlpath) << endmsg;
- return 1;
- }
+ info << string_compose(_("Loading history from '%1'."), xml_path.to_string()) << endmsg;
- if (!tree.read (xmlpath)) {
- error << string_compose (_("Could not understand session history file \"%1\""), xmlpath) << endmsg;
- return -1;
- }
+ if (!sys::exists (xml_path)) {
+ info << string_compose (_("%1: no history file \"%2\" for this session."),
+ _name, xml_path.to_string()) << endmsg;
+ return 1;
+ }
+
+ if (!tree.read (xml_path.to_string())) {
+ error << string_compose (_("Could not understand session history file \"%1\""),
+ xml_path.to_string()) << endmsg;
+ return -1;
+ }
- /* replace history */
- _history.clear();
+ // replace history
+ _history.clear();
for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) {