Remove duplicate API to find session files (ignore `._` files)

Session::possible_states correctly filters files
and also directly returns sorted base-names.

We can remove the redundant `get_state_files_in_directory`
API now.

see also 193b35e885
This commit is contained in:
Robin Gareus 2023-06-07 17:37:40 +02:00
parent 04d50ab880
commit 91579608b2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 5 additions and 26 deletions

View File

@ -1109,9 +1109,7 @@ ARDOUR_UI::process_snapshot_session_prompter (Prompter& prompter, bool switch_to
}
}
vector<std::string> p;
get_state_files_in_directory (_session->session_directory().root_path(), p);
vector<string> n = get_file_names_no_extension (p);
vector<std::string> n = Session::possible_states (_session->session_directory().root_path());
if (find (n.begin(), n.end(), snapname) != n.end()) {

View File

@ -202,17 +202,12 @@ EditorSnapshots::redisplay ()
return;
}
vector<std::string> state_file_paths;
vector<string> state_file_names = _session->possible_states ();
get_state_files_in_directory (_session->session_directory().root_path(),
state_file_paths);
if (state_file_paths.empty()) {
if (state_file_names.empty()) {
return;
}
vector<string> state_file_names (get_file_names_no_extension(state_file_paths));
_snapshot_model->clear ();
for (vector<string>::iterator i = state_file_names.begin(); i != state_file_names.end(); ++i)

View File

@ -786,14 +786,7 @@ SessionDialog::redisplay_recent_sessions ()
int session_snapshot_count = 0;
for (vector<std::string>::const_iterator i = session_directories.begin(); i != session_directories.end(); ++i) {
std::vector<std::string> state_file_paths;
// now get available states for this session
get_state_files_in_directory (*i, state_file_paths);
vector<string> states;
vector<const gchar*> item;
string dirname = *i;
/* remove any trailing / */
@ -813,17 +806,10 @@ SessionDialog::redisplay_recent_sessions ()
}
/* now get available states for this session */
states = Session::possible_states (dirname);
if (states.empty()) {
/* no state file? */
continue;
}
std::vector<string> state_file_names(get_file_names_no_extension (state_file_paths));
vector<string> state_file_names = Session::possible_states (dirname);
if (state_file_names.empty()) {
/* no state file? */
continue;
}