FileSource should not generate its own error message when a file is missing
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 15 Sep 2014 16:38:16 +0000 (12:38 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 15 Sep 2014 22:24:08 +0000 (18:24 -0400)
Conflicts:
libs/ardour/file_source.cc

libs/ardour/file_source.cc

index 30ae2178fe40b2b33a47100b914c63c7a50264a0..5833d29e3a7ebe981b9d00180549888e4c20f84c 100644 (file)
@@ -256,8 +256,6 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist
 
                 split (search_path, dirs, ':');
 
-                hits.clear ();
-
                 for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
 
                         fullpath = Glib::build_filename (*i, path);
@@ -312,9 +310,9 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist
                        /* no match: error */
 
                         if (must_exist) {
-                                error << string_compose(
-                                        _("Filesource: cannot find required file (%1): while searching %2"),
-                                        path, search_path) << endmsg;
+                               /* do not generate an error here, leave that to
+                                  whoever deals with the false return value.
+                               */
                                 goto out;
                         } else {
                                 isnew = true;
@@ -325,16 +323,17 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist
                        
                        keeppath = de_duped_hits[0];
                }
-                                                 
-        } else {
+                                                  
+       } else {
                 keeppath = path;
         }
 
         /* Current find() is unable to parse relative path names to yet non-existant
            sources. QuickFix(tm)
         */
-        if (keeppath == "") {
-                if (must_exist) {
+
+       if (keeppath.empty()) {
+               if (must_exist) {
                         error << "FileSource::find(), keeppath = \"\", but the file must exist" << endl;
                 } else {
                         keeppath = path;