summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-07-05 00:09:34 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-07-05 00:09:34 +0000
commitdfb5fef0a7dbdffe08bea23b48f4f182308e9b7c (patch)
treee66cd6ba525c4f31ee27213ad4f22116f9bbbf46
parent6e72885a5422b2d5aa9fdceec5652e5a0d7be116 (diff)
handle session names provided by user that contain '/' (mantis #1193)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5326 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour_ui.cc15
-rw-r--r--libs/ardour/session_state.cc12
2 files changed, 15 insertions, 12 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 726873dffc..f99f548398 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -2209,8 +2209,9 @@ ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be
Glib::ustring session_name;
Glib::ustring session_path;
Glib::ustring template_name;
+ Glib::ustring legal_session_folder_name;
int response;
-
+
begin:
response = Gtk::RESPONSE_NONE;
@@ -2307,7 +2308,7 @@ ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be
if (response == Gtk::RESPONSE_OK) {
session_name = new_session_dialog->session_name();
-
+
if (session_name.empty()) {
response = Gtk::RESPONSE_NONE;
goto try_again;
@@ -2325,7 +2326,7 @@ ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be
session_name = Glib::path_get_basename (session_name);
} else {
-
+
session_path = new_session_dialog->session_folder();
}
@@ -2340,11 +2341,13 @@ ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be
case NewSessionDialog::NewPage: /* nominally the "new" session creator, but could be in use for an old session */
should_be_new = true;
-
+
+ legal_session_folder_name = legalize_for_path (session_name);
+
//XXX This is needed because session constructor wants a
//non-existant path. hopefully this will be fixed at some point.
-
- session_path = Glib::build_filename (session_path, session_name);
+
+ session_path = Glib::build_filename (session_path, legal_session_folder_name);
if (Glib::file_test (session_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 6e13e3977f..dff589c231 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -676,7 +676,7 @@ Session::save_state (string snapshot_name, bool pending)
/* proper save: use _statefile_suffix (.ardour in English) */
xml_path = _path;
- xml_path += snapshot_name;
+ xml_path += legalize_for_path (snapshot_name);
xml_path += _statefile_suffix;
/* make a backup copy of the old file */
@@ -691,7 +691,7 @@ Session::save_state (string snapshot_name, bool pending)
/* pending save: use _pending_suffix (.pending in English) */
xml_path = _path;
- xml_path += snapshot_name;
+ xml_path += legalize_for_path (snapshot_name);
xml_path += _pending_suffix;
}
@@ -699,7 +699,7 @@ Session::save_state (string snapshot_name, bool pending)
string tmp_path;
tmp_path = _path;
- tmp_path += snapshot_name;
+ tmp_path += legalize_for_path (snapshot_name);
tmp_path += ".tmp";
// cerr << "actually writing state to " << xml_path << endl;
@@ -762,7 +762,7 @@ Session::load_state (string snapshot_name)
/* check for leftover pending state from a crashed capture attempt */
xmlpath = _path;
- xmlpath += snapshot_name;
+ xmlpath += legalize_for_path (snapshot_name);
xmlpath += _pending_suffix;
if (Glib::file_test (xmlpath, Glib::FILE_TEST_EXISTS)) {
@@ -3111,7 +3111,7 @@ Session::save_history (string snapshot_name)
snapshot_name = _current_snapshot_name;
}
- xml_path = _path + snapshot_name + ".history";
+ xml_path = _path + legalize_for_path (snapshot_name) + ".history";
bak_path = xml_path + ".bak";
@@ -3160,7 +3160,7 @@ Session::restore_history (string snapshot_name)
}
/* read xml */
- xmlpath = _path + snapshot_name + ".history";
+ xmlpath = _path + legalize_for_path (snapshot_name) + ".history";
cerr << string_compose(_("Loading history from '%1'."), xmlpath) << endmsg;
if (!Glib::file_test (xmlpath, Glib::FILE_TEST_EXISTS)) {