Fix egregious logic bug in FileSource::removable() and introduce FileSource::is_stub...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 7 Feb 2014 22:16:13 +0000 (17:16 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 7 Feb 2014 22:17:30 +0000 (17:17 -0500)
libs/ardour/file_source.cc

index 09214981861f142536d714b894b44adeb8e2d2a1..c6f3a9cd5d9f120739dc5de41127f4ae1ae3cbd3 100644 (file)
@@ -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;
+}
+