diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-02-07 17:16:13 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-02-07 17:17:30 -0500 |
commit | 2c679132454fc3e4fdad28b1a87f11e923c236c6 (patch) | |
tree | 8fec534bbfc29aa2b87dbae78ebed07c2dd3ade8 /libs/ardour/file_source.cc | |
parent | ed75b9425b9d384d24f1c4fe41afd9f3a61a2d09 (diff) |
Fix egregious logic bug in FileSource::removable() and introduce FileSource::is_stub() to hide logic for deciding if a source (file) is a stub
Diffstat (limited to 'libs/ardour/file_source.cc')
-rw-r--r-- | libs/ardour/file_source.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 0921498186..c6f3a9cd5d 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -101,7 +101,7 @@ FileSource::removable () const { bool r = ((_flags & Removable) && ((_flags & RemoveAtDestroy) || - ((_flags & RemovableIfEmpty) && empty() == 0))); + ((_flags & RemovableIfEmpty) && empty()))); return r; } @@ -589,3 +589,21 @@ FileSource::inc_use_count () Source::inc_use_count (); } +bool +FileSource::is_stub () const +{ + if (!empty()) { + return false; + } + + if (!removable()) { + return false; + } + + if (Glib::file_test (_path, Glib::FILE_TEST_EXISTS)) { + return false; + } + + return true; +} + |