mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-19 21:26:26 +01:00
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
This commit is contained in:
parent
d8d24a7521
commit
d07c90b003
1 changed files with 14 additions and 15 deletions
|
|
@ -40,6 +40,7 @@
|
||||||
#include <pbd/stl_delete.h>
|
#include <pbd/stl_delete.h>
|
||||||
#include <pbd/basename.h>
|
#include <pbd/basename.h>
|
||||||
#include <pbd/stacktrace.h>
|
#include <pbd/stacktrace.h>
|
||||||
|
#include <pbd/file_utils.h>
|
||||||
|
|
||||||
#include <ardour/audioengine.h>
|
#include <ardour/audioengine.h>
|
||||||
#include <ardour/configuration.h>
|
#include <ardour/configuration.h>
|
||||||
|
|
@ -3374,10 +3375,9 @@ Session::RoutePublicOrderSorter::operator() (boost::shared_ptr<Route> a, boost::
|
||||||
void
|
void
|
||||||
Session::remove_empty_sounds ()
|
Session::remove_empty_sounds ()
|
||||||
{
|
{
|
||||||
PathScanner scanner;
|
vector<string> audio_filenames;
|
||||||
|
|
||||||
vector<string *>* possible_audiofiles = scanner (_session_dir->sound_path().to_string (),
|
get_files_in_directory (_session_dir->sound_path(), audio_filenames);
|
||||||
Config->get_possible_audio_file_regexp (), false, true);
|
|
||||||
|
|
||||||
Glib::Mutex::Lock lm (source_lock);
|
Glib::Mutex::Lock lm (source_lock);
|
||||||
|
|
||||||
|
|
@ -3394,27 +3394,26 @@ Session::remove_empty_sounds ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (vector<string *>::iterator i = possible_audiofiles->begin(); i != possible_audiofiles->end(); ++i) {
|
for (vector<string>::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) {
|
if (regexec (&compiled_tape_track_pattern, i->c_str(), 0, 0, 0) == 0) {
|
||||||
delete *i;
|
|
||||||
continue;
|
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());
|
unlink (peak_path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
delete* i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete possible_audiofiles;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue