- if (loadIfNeeded(buffer, params_)) {
- Buffer * tmp = bufferlist.getBuffer(included_file);
-
- // FIXME: this should be a GUI warning
- if (tmp->params().textclass != buffer.params().textclass) {
- lyxerr << "WARNING: Included file `"
- << MakeDisplayPath(included_file)
- << "' has textclass `"
- << tmp->params().getLyXTextClass().name()
- << "' while parent file has textclass `"
- << buffer.params().getLyXTextClass().name()
- << "'." << endl;
+ // 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()));
+ Alert::warning(_("Different textclasses"), text);