- // Only load the bibkeys once if we're loading up the buffer,
- // else load them afresh each time.
- map<Buffer const *, bool>::iterator lit = loading_buffer.find(&buffer);
- if (lit == loading_buffer.end())
- loading_buffer[&buffer] = true;
-
- bool loadkeys = !loading_buffer[&buffer];
- if (!loadkeys) {
- CachedMap::iterator kit = cached_keys.find(&buffer);
- loadkeys = kit == cached_keys.end();
+ // and cache the timestamp of the bibliography files.
+ static std::map<FileName, time_t> bibfileStatus;
+
+ biblio::InfoMap infomap;
+
+ vector<FileName> const & bibfilesCache = buffer.getBibfilesCache();
+ // compare the cached timestamps with the actual ones.
+ bool changed = false;
+ for (vector<FileName>::const_iterator it = bibfilesCache.begin();
+ it != bibfilesCache.end(); ++ it) {
+ FileName const f = *it;
+ try {
+ std::time_t lastw = fs::last_write_time(f.toFilesystemEncoding());
+ if (lastw != bibfileStatus[f]) {
+ changed = true;
+ bibfileStatus[f] = lastw;
+ }
+ }
+ catch (fs::filesystem_error & fserr) {
+ changed = true;
+ lyxerr << "Couldn't find or read bibtex file "
+ << f << endl;
+ lyxerr[Debug::DEBUG] << "Fs error: "
+ << fserr.what() << endl;
+ }