summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-09-04 04:48:09 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-09-04 04:48:09 +0000
commitb49e50afacdfba7bf799c290b783daf3a0c5cfef (patch)
tree0381ae5b400d2122e52bdb07c8da2fb6ab12d267
parent911e30a73a0665de9bef7daeb8b2640ef5473a27 (diff)
Use functions from pbd/filesystem.h in Session::remove_state for portability
Add ARDOUR::backup_suffix to ardour/filename_extensions.h/cc git-svn-id: svn://localhost/ardour2/trunk@2374 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/filename_extensions.h1
-rw-r--r--libs/ardour/filename_extensions.cc1
-rw-r--r--libs/ardour/session_state.cc15
3 files changed, 11 insertions, 6 deletions
diff --git a/libs/ardour/ardour/filename_extensions.h b/libs/ardour/ardour/filename_extensions.h
index 83aafcf480..06ffe4b0e1 100644
--- a/libs/ardour/ardour/filename_extensions.h
+++ b/libs/ardour/ardour/filename_extensions.h
@@ -8,6 +8,7 @@ extern const char* const template_suffix;
extern const char* const statefile_suffix;
extern const char* const pending_suffix;
extern const char* const peakfile_suffix;
+extern const char* const backup_suffix;
}
diff --git a/libs/ardour/filename_extensions.cc b/libs/ardour/filename_extensions.cc
index 332e7a6995..9361c7a3da 100644
--- a/libs/ardour/filename_extensions.cc
+++ b/libs/ardour/filename_extensions.cc
@@ -8,5 +8,6 @@ const char* const template_suffix = X_(".template");
const char* const statefile_suffix = X_(".ardour");
const char* const pending_suffix = X_(".pending");
const char* const peakfile_suffix = X_(".peak");
+const char* const backup_suffix = X_(".bak");
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index c043b3b1ba..99cf4ba4a3 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -538,17 +538,20 @@ Session::remove_state (string snapshot_name)
/* refuse to remove the current snapshot or the "main" one */
return;
}
-
- const string xml_path = _path + snapshot_name + statefile_suffix;
+
+ sys::path xml_path(_session_dir->root_path());
+
+ xml_path /= snapshot_name + statefile_suffix;
+
+ sys::path backup_path(xml_path.to_string() + backup_suffix);
/* make a backup copy of the state file */
- const string bak_path = xml_path + ".bak";
- if (g_file_test (xml_path.c_str(), G_FILE_TEST_EXISTS)) {
- copy_file (xml_path, bak_path);
+ if (sys::exists (xml_path)) {
+ copy_file (xml_path.to_string(), backup_path.to_string());
}
/* and delete it */
- unlink (xml_path.c_str());
+ sys::remove (xml_path);
}
int