- if (loadIfNeeded(buffer, params_)) {
- Buffer * tmp = bufferlist.getBuffer(included_file);
-
- if (tmp->params().textclass != buffer.params().textclass) {
- string text = bformat(_("Included file `%1$s'\n"
- "has textclass `%2$s'\n"
- "while parent file has textclass `%3$s'."),
- MakeDisplayPath(included_file),
- tmp->params().getLyXTextClass().name(),
- buffer.params().getLyXTextClass().name());
+ // if incfile is relative, make it relative to the master
+ // buffer directory.
+ if (!absolutePath(incfile)) {
+ incfile = makeRelPath(included_file.absFilename(),
+ m_buffer->filePath());
+ }
+
+ // write it to a file (so far the complete file)
+ string const exportfile = changeExtension(incfile, ".tex");
+ string const mangled = DocFileName(changeExtension(included_file.absFilename(),
+ ".tex")).mangledFilename();
+ FileName const writefile(makeAbsPath(mangled, m_buffer->temppath()));
+
+ if (!runparams.nice)
+ incfile = mangled;
+ lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
+ lyxerr[Debug::LATEX] << "exportfile:" << exportfile << endl;
+ lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
+
+ if (runparams.inComment || runparams.dryrun)
+ // Don't try to load or copy the file
+ ;
+ else if (loadIfNeeded(buffer, params_)) {
+ Buffer * tmp = theBufferList().getBuffer(included_file.absFilename());
+
+ if (tmp->params().textclass != m_buffer->params().textclass) {
+ // FIXME UNICODE
+ docstring text = bformat(_("Included file `%1$s'\n"
+ "has textclass `%2$s'\n"
+ "while parent file has textclass `%3$s'."),
+ makeDisplayPath(included_file.absFilename()),
+ from_utf8(tmp->params().getLyXTextClass().name()),
+ from_utf8(m_buffer->params().getLyXTextClass().name()));