From 6033e5813fd733fac2003cbad7d8b1c90a1e7e59 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Mon, 20 Jun 2005 08:44:21 +0000 Subject: [PATCH] fix quoted graphics filenames git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@10090 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 5 +++++ src/insets/insetgraphics.C | 24 +++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 720c51a0c1..1efb36043c 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2005-06-18 Georg Baum + + * insetgraphics.C (prepareFile): Don't strip the extension, because + the substitution does not work when the file names are quoted + 2005-04-17 Angus Leeming * insetbib.C (latex): diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 16ceaccc19..d0817699e2 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -527,9 +527,18 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const { // LaTeX can cope if the graphics file doesn't exist, so just // return the filename. - string const orig_file = params().filename; + string orig_file = params().filename; string orig_file_with_path = MakeAbsPath(orig_file, buf->filePath()); + if (!IsFileReadable(orig_file_with_path)) { + if (IsFileReadable(orig_file_with_path + ".eps")) { + orig_file += ".eps"; + orig_file_with_path += ".eps"; + } else if (IsFileReadable(orig_file_with_path + ".ps")) { + orig_file += ".ps"; + orig_file_with_path += ".ps"; + } + } lyxerr[Debug::GRAPHICS] << "[InsetGraphics::prepareFile] orig_file = " << orig_file << "\n\twith path: " << orig_file_with_path << endl; @@ -592,11 +601,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const // No conversion is needed. LaTeX can handle the // graphic file as is. // This is true even if the orig_file is compressed. - if (formats.getFormat(to)->extension() == GetExtension(orig_file)) { - return RemoveExtension(orig_file_with_path); - } else { - return orig_file_with_path; - } + return orig_file_with_path; } // We're going to be running the exported buffer through the LaTeX @@ -650,10 +655,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const if (from == to) { // No conversion is needed. LaTeX can handle the // graphic file as is. - if (formats.getFormat(to)->extension() == GetExtension(orig_file)) - return RemoveExtension(temp_file); - else - return temp_file; + return temp_file; } } @@ -691,7 +693,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const #endif } - return RemoveExtension(temp_file); + return ChangeExtension(temp_file, formats.getFormat(to)->extension()); }