summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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