From c0c68dbf4dbe59f68bae94fa393f3f8e4e1a3196 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 28 Jun 2014 21:57:04 +0200 Subject: [PATCH] consolidate session_dirs: use Searchpath instead of custom code --- libs/ardour/session_state.cc | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index a5d71181a7..c9267b058f 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2632,8 +2632,6 @@ Session::cleanup_sources (CleanupReport& rep) vector > dead_sources; string audio_path; string midi_path; - vector::iterator i; - vector::iterator nexti; vector candidates; vector unused; set all_sources; @@ -2642,6 +2640,8 @@ Session::cleanup_sources (CleanupReport& rep) int ret = -1; string tmppath1; string tmppath2; + Searchpath asp; + Searchpath msp; _state_of_the_state = (StateOfTheState) (_state_of_the_state | InCleanup); @@ -2683,38 +2683,20 @@ Session::cleanup_sources (CleanupReport& rep) /* build a list of all the possible audio directories for the session */ - for (i = session_dirs.begin(); i != session_dirs.end(); ) { - - nexti = i; - ++nexti; - + for (vector::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) { SessionDirectory sdir ((*i).path); - audio_path += sdir.sound_path(); - - if (nexti != session_dirs.end()) { - audio_path += G_SEARCHPATH_SEPARATOR; - } - - i = nexti; + asp += sdir.sound_path(); } + audio_path += asp.to_string(); /* build a list of all the possible midi directories for the session */ - for (i = session_dirs.begin(); i != session_dirs.end(); ) { - - nexti = i; - ++nexti; - + for (vector::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) { SessionDirectory sdir ((*i).path); - midi_path += sdir.midi_path(); - - if (nexti != session_dirs.end()) { - midi_path += G_SEARCHPATH_SEPARATOR; - } - - i = nexti; + msp += sdir.midi_path(); } + midi_path += msp.to_string(); find_files_matching_filter (candidates, audio_path, accept_all_audio_files, (void *) 0, true, true); find_files_matching_filter (candidates, midi_path, accept_all_midi_files, (void *) 0, true, true);