]> git.lyx.org Git - features.git/commitdiff
make sure extensions are kept when necessary
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 19 Dec 2002 10:07:35 +0000 (10:07 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 19 Dec 2002 10:07:35 +0000 (10:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5870 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetgraphics.C

index 9632c5c166511ac78a833f3b19939d08785a7fba..bba54dfa728f10e7511710a37d386b3025e47293 100644 (file)
@@ -1,3 +1,10 @@
+2002-12-18  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * insetgraphics.C (prepareFile): do not remove the extension of
+       the file name if it is not the default extension for the given
+       format (that is, in latex output, remove extension from foo.eps,
+       but not from foo.epsi)
+
 2002-12-17  Alfredo Braunstein <abraunst@libero.it>
 
        * insettext.C (lfunMouseRelease): hackish solution to the "double
index 79bb4f0a93f4bd036ed947056dba2301390f22dd..5fb9e605722dabd07f919009577dcf4fbb9823c9 100644 (file)
@@ -592,11 +592,16 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const
        lyxerr[Debug::GRAPHICS]
                << "\t we have: from " << from << " to " << to << '\n';
 
-       if (from == to && !lyxrc.use_tempdir)
+       if (from == to && !lyxrc.use_tempdir) {
                // No conversion is needed. LaTeX can handle the
                // graphic file as is.
                // This is true even if the orig_file is compressed.
-               return RemoveExtension(orig_file_with_path);
+               if (formats.getFormat(to)->extension() == GetExtension(orig_file)) {
+                       return RemoveExtension(orig_file_with_path);
+               } else {
+                       return orig_file_with_path;
+               }
+       } 
 
        // We're going to be running the exported buffer through the LaTeX
        // compiler, so must ensure that LaTeX can cope with the graphics
@@ -639,12 +644,16 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const
                        }
                }
 
-               if (from == to)
+               if (from == to) {
                        // No conversion is needed. LaTeX can handle the
                        // graphic file as is.
-                       return RemoveExtension(temp_file);
+                       if (formats.getFormat(to)->extension() == GetExtension(orig_file)) 
+                               return RemoveExtension(temp_file);
+                       else 
+                               return temp_file;
+               }
        }
-
+       
        string const outfile_base = RemoveExtension(temp_file);
        lyxerr[Debug::GRAPHICS]
                << "\tThe original file is " << orig_file << "\n"