- ifstream ifs(file.c_str());
- string token;
- bool using_bibtex = false;
- while (getline(ifs, token)) {
- if (contains(token, "\\bibdata{")) {
- using_bibtex = true;
- string::size_type a = token.find("\\bibdata{") + 9;
- string::size_type b = token.find_first_of("}", a);
- string data = token.substr(a, b - a);
- // data is now all the bib files separated by ','
- // get them one by one and pass them to the helper
- do {
- b = data.find_first_of(',', 0);
- string l;
- if (b == string::npos)
- l = data;
- else {
- l = data.substr(0, b - 0);
- data.erase(0, b + 1);
- }
- string full_l =
- findtexfile(
- ChangeExtension(l, "bib", false),
- "bib");
- lyxerr << "data = `"
- << full_l << "'" << endl;
- if (!full_l.empty()) {
- // add full_l to the dep file.
- dep.insert(full_l, true);
- }
- } while (b != string::npos);
- } else if (contains(token, "\\bibstyle{")) {
- using_bibtex = true;
- string::size_type a = token.find("\\bibstyle{") + 10;
- string::size_type b = token.find_first_of("}", a);
- string style = token.substr(a, b - a);
- // token is now the style file
- // pass it to the helper
- string full_l =
- findtexfile(
- ChangeExtension(style, "bst", false),
- "bst");
- lyxerr << "style = `"
- << full_l << "'" << endl;
- if (!full_l.empty()) {
- // add full_l to the dep file.
- dep.insert(full_l, true);
- }
+ //string aux = OnlyFilename(ChangeExtension(file, ".aux"));
+
+ for (vector<Aux_Info>::const_iterator it = bibtex_info.begin();
+ it != bibtex_info.end(); ++it) {
+ for (set<string>::const_iterator it2 = it->databases.begin();
+ it2 != it->databases.end(); ++it2) {
+ string file = findtexfile(*it2, "bib");
+ if (!file.empty())
+ dep.insert(file, true);
+ }
+
+ for (set<string>::const_iterator it2 = it->styles.begin();
+ it2 != it->styles.end(); ++it2) {
+ string file = findtexfile(*it2, "bst");
+ if (!file.empty())
+ dep.insert(file, true);