format->isChildFormat())
format = getFormat(format->parentFormat());
if (!format || format->viewer().empty()) {
+#if USE_BOOST_FORMAT
Alert::alert(_("Cannot view file"),
boost::io::str(boost::format(_("No information for viewing %1$s"))
% prettyName(format_name)));
+#else
+ Alert::alert(_("Cannot view file"),
+ _("No information for viewing ")
+ + prettyName(format_name));
+#endif
return false;
}
if (format_name == "dvi" &&
!lyxrc.view_dvi_paper_option.empty()) {
- command += " " + lyxrc.view_dvi_paper_option;
+ command += ' ' + lyxrc.view_dvi_paper_option;
string paper_size = converters.papersize(buffer);
if (paper_size == "letter")
paper_size = "us";
- command += " " + paper_size;
+ command += ' ' + paper_size;
if (buffer->params.orientation
== BufferParams::ORIENTATION_LANDSCAPE)
command += 'r';
}
if (!contains(command, token_from))
- command += " " + token_from;
+ command += ' ' + token_from;
command = subst(command, token_from,
QuoteName(OnlyFilename(filename)));
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->tmppath, "tmpfile.out");
+ }
+
if (conv.latex) {
run_latex = true;
string command = subst(conv.command, token_from, "");
} else
res = one.startscript(type, command);
+ if (!real_outfile.empty()) {
+ if (!lyx::rename(outfile, real_outfile))
+ res = -1;
+ else
+ lyxerr[Debug::FILES]
+ << "renaming file " << outfile
+ << " to " << real_outfile
+ << endl;
+ }
+
if (!conv.parselog.empty()) {
string const logfile = infile2 + ".log";
string const script = LibScriptSearch(conv.parselog);
string to = subst(conv.result_dir,
token_base, to_base);
if (!lyx::rename(from, to)) {
+#if USE_BOOST_FORMAT
Alert::alert(_("Error while trying to move directory:"),
from, boost::io::str(boost::format(_("to %1$s")) % to));
+#else
+ Alert::alert(_("Error while trying to move directory:"),
+ from, _("to ") + to);
+#endif
return false;
}
}
return move(outfile, to_file, conv.latex);
}
+
// If from = /path/file.ext and to = /path2/file2.ext2 then this method
// moves each /path/file*.ext file to /path2/file2*.ext2'
bool Converters::move(string const & from, string const & to, bool copy)
? lyx::copy(from2, to2)
: lyx::rename(from2, to2);
if (!moved && no_errors) {
+#if USE_BOOST_FORMAT
Alert::alert(_("Error while trying to move file:"),
from2, boost::io::str(boost::format(_("to %1$s")) % to2));
+#else
+ Alert::alert(_("Error while trying to move file:"),
+ from2, _("to ") + to2);
+#endif
no_errors = false;
}
}
}
string head;
split(command, head, ' ');
+#if USE_BOOST_FORMAT
Alert::alert(boost::io::str(boost::format(_("There were errors during running of %1$s")) % head),
s, t);
+#else
+ Alert::alert(_("There were errors during running of ") + head,
+ s, t);
+#endif
return false;
} else if (result & LaTeX::NO_OUTPUT) {
string const s = _("The operation resulted in");