]> git.lyx.org Git - lyx.git/blobdiff - src/Converter.cpp
Fix bug #2213 (part 1): GuiChanges lacks "Previous Change" button.
[lyx.git] / src / Converter.cpp
index 111aa92c28b06c6f32f1000f70af7630d937843a..fd4e7856f76f644219d1b938279c156e0b141f95 100644 (file)
@@ -48,6 +48,7 @@ string const token_from("$$i");
 string const token_base("$$b");
 string const token_to("$$o");
 string const token_path("$$p");
+string const token_orig_path("$$r");
 
 
 
@@ -302,6 +303,14 @@ bool Converters::convert(Buffer const * buffer,
                                return true;
                        }
                }
+
+               // only warn once per session and per file type
+               static std::map<string, string> warned;
+               if (warned.find(from_format) != warned.end() && warned.find(from_format)->second == to_format) {
+                       return false;
+               }
+               warned.insert(make_pair(from_format, to_format));
+
                Alert::error(_("Cannot convert file"),
                             bformat(_("No information for converting %1$s "
                                                    "format files to %2$s.\n"
@@ -352,7 +361,7 @@ bool Converters::convert(Buffer const * buffer,
                // if input and output files are equal, we use a
                // temporary file as intermediary (JMarc)
                FileName real_outfile;
-               if (outfile.absFilename() == infile.absFilename()) {
+               if (outfile == infile) {
                        real_outfile = infile;
                        // when importing, a buffer does not necessarily exist
                        if (buffer)
@@ -386,6 +395,8 @@ bool Converters::convert(Buffer const * buffer,
                        command = subst(command, token_from, quoteName(infile2));
                        command = subst(command, token_base, quoteName(from_base));
                        command = subst(command, token_to, quoteName(outfile2));
+                       command = subst(command, token_path, quoteName(infile.onlyPath().absFilename()));
+                       command = subst(command, token_orig_path, quoteName(orig_from.onlyPath().absFilename()));
                        command = libScriptSearch(command);
 
                        if (!conv.parselog.empty())