Bo Peng wrote:
On Thu, Mar 27, 2008 at 9:47 PM, Bo Peng <[EMAIL PROTECTED]> wrote:
I am reading your patch and hopefully can make it
> work.
void InsetBibtex::registerEmbeddedFiles(EmbeddedFileList & files) const
{
- if (bibfiles_.empty())
- createBibFiles(params()["bibfiles"], params()["embed"]);
+ LYXERR(Debug::FILES, "Create bib files from parameters "
+ << getParam("bibfiles") << " and " << getParam("embed") <<
std:: endl);
- EmbeddedFileList::const_iterator it = bibfiles_.begin();
- EmbeddedFileList::const_iterator it_end = bibfiles_.end();
- for (; it != it_end; ++it)
- files.registerFile(*it, this, buffer());
+ ParamData data = makeParamStruct();
+ ParamDataCit it = data.begin();
+ ParamDataCit en = data.end();
+ for (; it != en; ++it) {
+ FileName bibfile = getBibTeXPath(it->bibfile, buffer());
+ files.registerFile(bibfile.absFilename(), to_utf8(it->embfile),
+ !it->embfile.empty(), this, buffer());
+ }
}
The registered EmbeddedFile does not have the correct 'enabled'
status, and there is no guarantee that the embedded file exists. (This
may be the reason for your crashes). If you really want to do it here,
you will have to enable each EmbeddedFile, and clear embed flag if it
fails. Then you will need to update your param strcuture.
I don't really understand this. The registered file will get its enabled
status when it's constructed:
EmbeddedFile::EmbeddedFile(std::string const & file,
std::string const & inzipName, bool embed, Buffer const & buf)
: DocFileName("", false), inzip_name_(inzipName), inset_list_()
{
DocFileName::set(file, buf.filePath());
setEmbed(embed);
enable(buf.embedded(), &buf, true);
}
And then it will have whatever status it has. Why should InsetBibtex
need to know about that? It doesn't store the information in the LyX
file or use it in any way.
rh