- file = AddName(buffer->tmppath, file);
- file = ChangeExtension(file, backend_format);
+ filename = AddName(buffer->tmppath, filename);
+ filename = ChangeExtension(filename,
+ formats.extension(backend_format));
+
+ // Ascii backend
+ if (backend_format == "text")
+ buffer->writeFileAscii(filename, lyxrc.ascii_linelen);
+ // Linuxdoc backend
+ else if (buffer->isLinuxDoc())
+ buffer->makeLinuxDocFile(filename, !put_in_tempdir);
+ // Docbook backend
+ else if (buffer->isDocBook())
+ buffer->makeDocBookFile(filename, !put_in_tempdir);
+ // LaTeX backend
+ else if (backend_format == format)
+ buffer->makeLaTeXFile(filename, string(), true);
+ else if (contains(buffer->filePath(), ' ')) {
+ Alert::alert(_("Cannot run latex."),
+ _("The path to the lyx file cannot contain spaces."));
+ return false;
+ } else
+ buffer->makeLaTeXFile(filename, buffer->filePath(), false);