summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-09-04 04:47:44 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-09-04 04:47:44 +0000
commit39cd07a96982b766ad2877edb17b78faa3b5360e (patch)
tree79a25775a293e0c7cbfe35497dce757167deb95c /libs
parent54f525770fe56222fb5552e02ae81c233e7ad165 (diff)
Use sys::path and SessionDirectory classes in Session::load_state for portability
git-svn-id: svn://localhost/ardour2/trunk@2368 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/session_state.cc33
1 files changed, 13 insertions, 20 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 62f7b4ae7c..592908f488 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -653,15 +653,12 @@ Session::load_state (string snapshot_name)
state_tree = 0;
}
- string xmlpath;
-
state_was_pending = false;
/* check for leftover pending state from a crashed capture attempt */
- xmlpath = _path;
- xmlpath += snapshot_name;
- xmlpath += pending_suffix;
+ sys::path xmlpath(_session_dir->root_path());
+ xmlpath /= snapshot_name + pending_suffix;
if (sys::exists (xmlpath)) {
@@ -673,14 +670,12 @@ Session::load_state (string snapshot_name)
}
if (!state_was_pending) {
-
- xmlpath = _path;
- xmlpath += snapshot_name;
- xmlpath += statefile_suffix;
+ xmlpath = _session_dir->root_path();
+ xmlpath /= snapshot_name + statefile_suffix;
}
if (!sys::exists (xmlpath)) {
- error << string_compose(_("%1: session state information file \"%2\" doesn't exist!"), _name, xmlpath) << endmsg;
+ error << string_compose(_("%1: session state information file \"%2\" doesn't exist!"), _name, xmlpath.to_string()) << endmsg;
return 1;
}
@@ -688,8 +683,8 @@ Session::load_state (string snapshot_name)
set_dirty();
- if (!state_tree->read (xmlpath)) {
- error << string_compose(_("Could not understand ardour file %1"), xmlpath) << endmsg;
+ if (!state_tree->read (xmlpath.to_string())) {
+ error << string_compose(_("Could not understand ardour file %1"), xmlpath.to_string()) << endmsg;
delete state_tree;
state_tree = 0;
return -1;
@@ -698,7 +693,7 @@ Session::load_state (string snapshot_name)
XMLNode& root (*state_tree->root());
if (root.name() != X_("Session")) {
- error << string_compose (_("Session file %1 is not an Ardour session"), xmlpath) << endmsg;
+ error << string_compose (_("Session file %1 is not an Ardour session"), xmlpath.to_string()) << endmsg;
delete state_tree;
state_tree = 0;
return -1;
@@ -719,18 +714,16 @@ Session::load_state (string snapshot_name)
}
if (is_old) {
- string backup_path;
- backup_path = _path;
- backup_path += snapshot_name;
- backup_path += "-1";
- backup_path += statefile_suffix;
+ sys::path backup_path(_session_dir->root_path());
+
+ backup_path /= snapshot_name + "-1" + statefile_suffix;
info << string_compose (_("Copying old session file %1 to %2\nUse %2 with Ardour versions before 2.0 from now on"),
- xmlpath, backup_path)
+ xmlpath.to_string(), backup_path.to_string())
<< endmsg;
- copy_file (xmlpath, backup_path);
+ copy_file (xmlpath.to_string(), backup_path.to_string());
/* if it fails, don't worry. right? */
}