Don't play too many nice tricks for non-existing graphics files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9667 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2005-02-22 16:57:36 +00:00
parent 906981b430
commit 9077ce75fd
2 changed files with 20 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2005-02-22 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* insetgraphics.C (prepareFile): handle non-existing files
* insetgraphics.C (latex): remove special handling of non-existing
files
2005-02-22 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetcharstyle.C: add TEXT_TO_INSET_OFFSET and adjust metrics.

View File

@ -532,7 +532,10 @@ string const stripExtensionIfPossible(string const & file, string const & to)
string const InsetGraphics::prepareFile(Buffer const & buf,
OutputParams const & runparams) const
{
// We assume that the file exists (the caller checks this)
// The following code depends on non-empty filenames
if (params().filename.empty())
return string();
string const orig_file = params().filename.absFilename();
string const rel_file = params().filename.relFilename(buf.filePath());
@ -549,6 +552,12 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
// of include files
Buffer const * m_buffer = buf.getMasterBuffer();
// Return the output name if the file does not exist.
// We are not going to change the extension or using the name of the
// temporary file, the code is already complicated enough.
if (!IsFileReadable(orig_file))
return params().filename.outputFilename(m_buffer->filePath());
// We place all temporary files in the master buffer's temp dir.
// This is possible because we use mangled file names.
// This is necessary for DVI export.
@ -731,15 +740,10 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
string latex_str = before + '{';
if (file_exists)
// Convert the file if necessary.
// Remove the extension so the LaTeX will use whatever
// is appropriate (when there are several versions in
// different formats)
latex_str += prepareFile(buf, runparams);
else
latex_str += relative_file + " not found!";
// Convert the file if necessary.
// Remove the extension so LaTeX will use whatever is appropriate
// (when there are several versions in different formats)
latex_str += prepareFile(buf, runparams);
latex_str += '}' + after;
os << latex_str;