summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-09-10 15:03:30 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-09-10 15:03:30 +0000
commit68e943265edf04e63a8e8b8f62bab20f99d9c637 (patch)
treeff8941a59662fc0c4622944b65f7b2d5e3bdd0c3 /libs/ardour/session_state.cc
parente4372df05b7d74a6b80dbbf4b6c00cc2b31c4723 (diff)
merge from 2.0-ongoing @ 3581
git-svn-id: svn://localhost/ardour2/branches/3.0@3711 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc48
1 files changed, 41 insertions, 7 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index c228f3c47b..8ebf3ab07b 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -432,8 +432,9 @@ Session::setup_raid_path (string path)
AudioFileSource::set_search_path (sound_search_path.to_string ());
SMFSource::set_search_path (midi_search_path.to_string ());
+
// reset the round-robin soundfile path thingie
-
+
last_rr_session_dir = session_dirs.begin();
}
@@ -1794,6 +1795,43 @@ Session::save_template (string template_name)
return 0;
}
+int
+Session::rename_template (string old_name, string new_name)
+{
+ sys::path old_path (user_template_directory());
+ old_path /= old_name + template_suffix;
+
+ sys::path new_path(user_template_directory());
+ new_path /= new_name + template_suffix;
+
+ if (sys::exists (new_path)) {
+ warning << string_compose(_("Template \"%1\" already exists - template not renamed"),
+ new_path.to_string()) << endmsg;
+ return -1;
+ }
+
+ try {
+ sys::rename (old_path, new_path);
+ return 0;
+ } catch (...) {
+ return -1;
+ }
+}
+
+int
+Session::delete_template (string name)
+{
+ sys::path path = user_template_directory();
+ path /= name + template_suffix;
+
+ try {
+ sys::remove (path);
+ return 0;
+ } catch (...) {
+ return -1;
+ }
+}
+
void
Session::refresh_disk_space ()
{
@@ -2009,17 +2047,13 @@ Session::XMLNamedSelectionFactory (const XMLNode& node)
string
Session::automation_dir () const
{
- string res = _path;
- res += "automation/";
- return res;
+ return Glib::build_filename (_path, "automation");
}
string
Session::analysis_dir () const
{
- string res = _path;
- res += "analysis/";
- return res;
+ return Glib::build_filename (_path, "analysis");
}
int