allow from and to files to be identical for conversion (using temp file)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH-1_2_X@5698 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2002-11-22 10:03:49 +00:00
parent 02ab0cc9eb
commit 75cb5a932e
3 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2002-11-18 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* converter.C (convert): if from and to files are the same, use a
temporary files as intermediary
2002-11-19 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lyx_main.C (queryUserLyXDir): re-run automatically the configure

View File

@ -619,6 +619,14 @@ bool Converters::convert(Buffer const * buffer,
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, "");
@ -668,6 +676,16 @@ bool Converters::convert(Buffer const * buffer,
} 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);

View File

@ -55,7 +55,7 @@ What's new
- fix bug with citation keys that contain spaces (this was a new bug
in 1.2.1)
- fix bug with handling of EPSI files (this was a new bug in 1.2.1)
- fix bugs with handling of EPSI files (epsi handling was new in 1.2.1)
- fix crash with undo