From d07c90b003d7680eb4e0fd91e526ce8b5596de92 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Tue, 4 Sep 2007 09:01:25 +0000 Subject: [PATCH] Use PBD::get_files_in_directory instead of PBD::Scanner in Session::remove_empty_sounds git-svn-id: svn://localhost/ardour2/trunk@2409 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/session.cc | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index bdb47415ec..d20f0fcf90 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -3374,10 +3375,9 @@ Session::RoutePublicOrderSorter::operator() (boost::shared_ptr a, boost:: void Session::remove_empty_sounds () { - PathScanner scanner; + vector audio_filenames; - vector* possible_audiofiles = scanner (_session_dir->sound_path().to_string (), - Config->get_possible_audio_file_regexp (), false, true); + get_files_in_directory (_session_dir->sound_path(), audio_filenames); Glib::Mutex::Lock lm (source_lock); @@ -3394,27 +3394,26 @@ Session::remove_empty_sounds () return; } - for (vector::iterator i = possible_audiofiles->begin(); i != possible_audiofiles->end(); ++i) { + for (vector::iterator i = audio_filenames.begin(); i != audio_filenames.end(); ++i) { - /* never remove files that appear to be a tape track */ + // never remove files that appear to be a tape track - if (regexec (&compiled_tape_track_pattern, (*i)->c_str(), 0, 0, 0) == 0) { - delete *i; + if (regexec (&compiled_tape_track_pattern, i->c_str(), 0, 0, 0) == 0) { continue; } - - if (AudioFileSource::is_empty (*this, *(*i))) { - unlink ((*i)->c_str()); + sys::path audio_file_path (_session_dir->sound_path()); + + audio_file_path /= *i; - string peak_path = peak_path_from_audio_path (**i); + if (AudioFileSource::is_empty (*this, audio_file_path.to_string())) { + + unlink (audio_file_path.to_string().c_str()); + + string peak_path = peak_path_from_audio_path (audio_file_path.to_string()); unlink (peak_path.c_str()); } - - delete* i; } - - delete possible_audiofiles; } bool