- string const file_ = (type == "cls") ? file + ".cls" : file + ".sty";
-
- lyxerr << "Search for classfile " << file_ << endl;
-
- string const lstfile = (type == "cls") ? "clsFiles.lst" : "styFiles.lst";
- string const allClasses = GetFileContents(LibFileSearch(string(), lstfile));
+ string file_ = file;
+ // do we need to add the suffix?
+ if (!(getExtension(file) == type))
+ file_ += '.' + type;
+
+ lyxerr << "Searching for file " << file_ << endl;
+
+ string lstfile;
+ if (type == "cls")
+ lstfile = "clsFiles.lst";
+ else if (type == "sty")
+ lstfile = "styFiles.lst";
+ else if (type == "bst")
+ lstfile = "bstFiles.lst";
+ else if (type == "bib")
+ lstfile = "bibFiles.lst";
+ FileName const abslstfile = libFileSearch(string(), lstfile);
+ if (abslstfile.empty()) {
+ lyxerr << "File `'" << lstfile << "' not found." << endl;
+ return string();
+ }
+ string const allClasses = getFileContents(abslstfile);