- string basename = ChangeExtension(from_file, "");
- for (vector< vector<Command>::iterator >::reverse_iterator rit =
- S.rbegin(); rit != S.rend(); ++rit) {
- it = *rit;
- lyxerr << "Converting from "
- << (*it).from << " to " << (*it).to << endl;
+ Graph::EdgePath edgepath = getPath(from_format, to_format);
+ if (edgepath.empty()) {
+ return false;
+ }
+ LatexRunParams runparams;
+ runparams.flavor = usePdflatex(edgepath) ?
+ LatexRunParams::PDFLATEX : LatexRunParams::LATEX;
+
+ string path = OnlyPath(from_file);
+ Path p(path);
+
+ bool run_latex = false;
+ string from_base = ChangeExtension(from_file, "");
+ string to_base = ChangeExtension(to_file, "");
+ string infile;
+ string outfile = from_file;
+ for (Graph::EdgePath::const_iterator cit = edgepath.begin();
+ cit != edgepath.end(); ++cit) {
+ Converter const & conv = converterlist_[*cit];
+ bool dummy = conv.To->dummy() && conv.to != "program";
+ if (!dummy)
+ lyxerr[Debug::FILES] << "Converting from "
+ << conv.from << " to " << conv.to << endl;
+ infile = outfile;
+ outfile = conv.result_dir.empty()
+ ? ChangeExtension(from_file, conv.To->extension())
+ : AddName(subst(conv.result_dir,
+ token_base, from_base),
+ subst(conv.result_file,
+ token_base, OnlyFilename(from_base)));
+
+ // if input and output files are equal, we use a
+ // temporary file as intermediary (JMarc)
+ string real_outfile;
+ if (outfile == infile) {
+ real_outfile = infile;
+ outfile = AddName(buffer->temppath(), "tmpfile.out");
+ }