#include "support/convert.h"
#include "support/debug.h"
#include "support/FileFilterList.h"
+#include "support/FileNameList.h"
#include "support/filetools.h"
#include "support/ForkedCalls.h"
#include "support/gettext.h"
using support::cmd_ret;
using support::createBufferTmpDir;
using support::FileName;
+using support::FileNameList;
using support::libFileSearch;
using support::latex_path;
using support::ltrim;
///
Undo undo_;
+
+ /// A cache for the bibfiles (including bibfiles of loaded child
+ /// documents), needed for appropriate update of natbib labels.
+ mutable FileNameList bibfilesCache_;
};
string const encoding = runparams.encoding->iconvName();
LYXERR(Debug::LATEX, "makeLaTeXFile encoding: " << encoding << "...");
- odocfstream ofs(encoding);
+ odocfstream ofs;
+ try { ofs.reset(encoding); }
+ catch (iconv_codecvt_facet_exception & e) {
+ lyxerr << "Caught iconv exception: " << e.what() << endl;
+ Alert::error(_("Iconv software exception Detected"), bformat(_("Please "
+ "verify that the support software for your encoding (%1$s) is "
+ "properly installed"), from_ascii(encoding)));
+ return false;
+ }
if (!openFileWrite(ofs, fname))
return false;
return;
}
- bibfilesCache_.clear();
+ d->bibfilesCache_.clear();
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
if (it->lyxCode() == BIBTEX_CODE) {
InsetBibtex const & inset =
static_cast<InsetBibtex const &>(*it);
- vector<FileName> const bibfiles = inset.getFiles(*this);
- bibfilesCache_.insert(bibfilesCache_.end(),
+ FileNameList const bibfiles = inset.getFiles(*this);
+ d->bibfilesCache_.insert(d->bibfilesCache_.end(),
bibfiles.begin(),
bibfiles.end());
} else if (it->lyxCode() == INCLUDE_CODE) {
InsetInclude & inset =
static_cast<InsetInclude &>(*it);
inset.updateBibfilesCache(*this);
- vector<FileName> const & bibfiles =
+ FileNameList const & bibfiles =
inset.getBibfilesCache(*this);
- bibfilesCache_.insert(bibfilesCache_.end(),
+ d->bibfilesCache_.insert(d->bibfilesCache_.end(),
bibfiles.begin(),
bibfiles.end());
}
}
-vector<FileName> const & Buffer::getBibfilesCache() const
+FileNameList const & Buffer::getBibfilesCache() const
{
// if this is a child document and the parent is already loaded
// use the parent's cache instead
return tmp->getBibfilesCache();
// We update the cache when first used instead of at loading time.
- if (bibfilesCache_.empty())
+ if (d->bibfilesCache_.empty())
const_cast<Buffer *>(this)->updateBibfilesCache();
- return bibfilesCache_;
+ return d->bibfilesCache_;
}