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
This commit is contained in:
Georg Baum 2005-06-20 08:44:21 +00:00
parent bd3566384a
commit 6033e5813f
2 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2005-06-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* 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 <leeming@lyx.org>
* insetbib.C (latex):

View File

@ -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,12 +601,8 @@ 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;
}
}
// We're going to be running the exported buffer through the LaTeX
// compiler, so must ensure that LaTeX can cope with the graphics
@ -650,9 +655,6 @@ 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;
}
}
@ -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());
}