Fix opening of recent sessions with mismatched directory & file names
When populating the list of recent sessions, and there's only one session file in the session folder, don't assume that the base name of the session file is the same as the name of the session directory. Allows loading sessions that were created with trailing spaces in their names from the recent sessions list, and also helps in the case that the session file (or directory) was renamed. There are actually two implementations of the 'recent sessions' chooser: this applies to both. I suppose a useful project one of these days would be to unify the two...
This commit is contained in:
parent
83ce8dde6b
commit
be7da2e952
|
@ -1440,14 +1440,14 @@ ARDOUR_UI::redisplay_recent_sessions ()
|
|||
|
||||
Gtk::TreeModel::Row row = *(recent_session_model->append());
|
||||
|
||||
row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath);
|
||||
row[recent_session_columns.fullpath] = fullpath;
|
||||
row[recent_session_columns.tip] = Glib::Markup::escape_text (fullpath);
|
||||
|
||||
if (state_file_names.size() > 1) {
|
||||
// multiple session files in the session directory - show the directory name.
|
||||
row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath);
|
||||
|
||||
// add the children
|
||||
|
||||
for (std::vector<std::string>::iterator i2 = state_file_names.begin();
|
||||
i2 != state_file_names.end(); ++i2)
|
||||
{
|
||||
|
@ -1458,6 +1458,9 @@ ARDOUR_UI::redisplay_recent_sessions ()
|
|||
child_row[recent_session_columns.fullpath] = fullpath;
|
||||
child_row[recent_session_columns.tip] = Glib::Markup::escape_text (fullpath);
|
||||
}
|
||||
} else {
|
||||
// only a single session file in the directory - show its actual name.
|
||||
row[recent_session_columns.visible_name] = state_file_names.front ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -653,9 +653,10 @@ SessionDialog::redisplay_recent_sessions ()
|
|||
|
||||
float sr;
|
||||
SampleFormat sf;
|
||||
std::string s = Glib::build_filename (dirname, state_file_names.front() + statefile_suffix);
|
||||
std::string state_file_basename = state_file_names.front();
|
||||
|
||||
std::string s = Glib::build_filename (dirname, state_file_basename + statefile_suffix);
|
||||
|
||||
row[recent_session_columns.visible_name] = Glib::path_get_basename (dirname);
|
||||
row[recent_session_columns.fullpath] = dirname; /* just the dir, but this works too */
|
||||
row[recent_session_columns.tip] = Glib::Markup::escape_text (dirname);
|
||||
|
||||
|
@ -680,9 +681,13 @@ SessionDialog::redisplay_recent_sessions ()
|
|||
++session_snapshot_count;
|
||||
|
||||
if (state_file_names.size() > 1) {
|
||||
// multiple session files in the session directory - show the directory name.
|
||||
// if there's not a session file with the same name as the session directory,
|
||||
// opening the parent item will fail, but expanding it will show the session
|
||||
// files that actually exist, and the right one can then be opened.
|
||||
row[recent_session_columns.visible_name] = Glib::path_get_basename (dirname);
|
||||
|
||||
// add the children
|
||||
|
||||
for (std::vector<std::string>::iterator i2 = state_file_names.begin(); i2 != state_file_names.end(); ++i2) {
|
||||
|
||||
Gtk::TreeModel::Row child_row = *(recent_session_model->append (row.children()));
|
||||
|
@ -712,6 +717,9 @@ SessionDialog::redisplay_recent_sessions ()
|
|||
|
||||
++session_snapshot_count;
|
||||
}
|
||||
} else {
|
||||
// only a single session file in the directory - show its actual name.
|
||||
row[recent_session_columns.visible_name] = state_file_basename;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user