- 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, true);
+ // Docbook backend
+ else if (buffer->isDocBook())
+ buffer->makeDocBookFile(filename, true);
+ // LaTeX backend
+ else if (backend_format == format)
+ buffer->makeLaTeXFile(filename, string(), true);
+ else if (contains(buffer->filepath, ' ')) {
+ WriteAlert(_("Cannot run latex."),
+ _("The path to the lyx file cannot contain spaces."));
+ return false;
+ } else
+ buffer->makeLaTeXFile(filename, buffer->filepath, false);