diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-09-08 17:12:14 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-09-08 17:12:14 +0000 |
commit | 3c45ab08468e552b1c6f2b5bd6dff2b74204a0b9 (patch) | |
tree | 0c683a85e54d4ad68bac8becf72202ab15a843dc /libs/ardour/session.cc | |
parent | 7c95da93ab608662a15e77c74bc5b4565438c104 (diff) |
never remove tape track source files even if empty, reconnect editor mute/solo buttons
git-svn-id: svn://localhost/ardour2/trunk@911 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index bafb43a57c..c7e349d14e 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3183,16 +3183,34 @@ Session::RoutePublicOrderSorter::operator() (boost::shared_ptr<Route> a, boost:: void Session::remove_empty_sounds () { - PathScanner scanner; - string dir; - dir = sound_dir (); - - vector<string *>* possible_audiofiles = scanner (dir, "\\.wav$", false, true); + vector<string *>* possible_audiofiles = scanner (sound_dir(), "\\.(wav|aiff|caf|w64)$", false, true); + + Glib::Mutex::Lock lm (audio_source_lock); + regex_t compiled_tape_track_pattern; + int err; + + if ((err = regcomp (&compiled_tape_track_pattern, "/T[0-9][0-9][0-9][0-9]-", REG_EXTENDED|REG_NOSUB))) { + + char msg[256]; + + regerror (err, &compiled_tape_track_pattern, msg, sizeof (msg)); + + error << string_compose (_("Cannot compile tape track regexp for use (%1)"), msg) << endmsg; + return; + } + for (vector<string *>::iterator i = possible_audiofiles->begin(); i != possible_audiofiles->end(); ++i) { + + /* 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; + continue; + } + if (AudioFileSource::is_empty (*this, *(*i))) { unlink ((*i)->c_str()); |