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
This commit is contained in:
Paul Davis 2009-07-05 00:09:34 +00:00
parent 6e72885a54
commit dfb5fef0a7
2 changed files with 15 additions and 12 deletions

View file

@ -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))) {

View file

@ -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)) {