13
0

FileSource should not generate its own error message when a file is missing

This commit is contained in:
Paul Davis 2014-09-15 12:38:16 -04:00
parent c96ec968c7
commit 596a9247bd

View File

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