From: Angus Leeming Date: Mon, 29 Apr 2002 09:24:19 +0000 (+0000) Subject: (Herbert): enable successful export to LaTeX if the graphics file is X-Git-Tag: 1.6.10~19323 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=030311739b476cf767dfad6a179ac059074622e4;p=features.git (Herbert): enable successful export to LaTeX if the graphics file is stored without extension. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4084 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 759095ec86..c6de2ce5d8 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -3,6 +3,11 @@ * insetfloatlist.C (getScreenLabel): Fix crash in the case where float type do not exist. +2002-04-28 Herbert Voss + + * insetgraphics.C (latex): fix bug with missing file-extension. + LaTeX still allows a missing "eps" or "ps". + 2002-04-26 Angus Leeming * insetfloat.C (c-tor, wide): translate the name of the float. diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 9eac436855..1bdc1c7ba7 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -703,16 +703,25 @@ int InsetGraphics::latex(Buffer const *buf, ostream & os, // If there is no file specified or not existing, // just output a message about it in the latex output. lyxerr[Debug::GRAPHICS] - << "InsetGraphics::latex. Filename = " + << "insetgraphics::latex: Filename = " << params().filename << endl; - string const message = - (IsFileReadable(MakeAbsPath(params().filename, buf->filePath())) - && !params().filename.empty()) ? - string() : - string("bb = 0 0 200 100, draft, type=eps]"); + // A missing (e)ps-extension is no problem for LaTeX, so + // we have to test three different cases + string const file_(MakeAbsPath(params().filename, buf->filePath())); + bool const file_exists = + !file_.empty() && + (IsFileReadable(file_) || // original + IsFileReadable(file_ + ".eps") || // original.eps + IsFileReadable(file_ + ".ps")); // original.ps + string const message = file_exists ? + string() : string("bb = 0 0 200 100, draft, type=eps]"); + // if !message.empty() than there was no existing file + // "filename(.(e)ps)" found. In this case LaTeX + // draws only a rectangle with the above bb and the + // not found filename in it. lyxerr[Debug::GRAPHICS] - << "InsetGraphics::latex. Message = " << message << endl; + << "InsetGraphics::latex. Message = \"" << message << '\"' << endl; // These variables collect all the latex code that should be before and // after the actual includegraphics command.