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> 2005-04-17 Angus Leeming <leeming@lyx.org>
* insetbib.C (latex): * 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 // LaTeX can cope if the graphics file doesn't exist, so just
// return the filename. // return the filename.
string const orig_file = params().filename; string orig_file = params().filename;
string orig_file_with_path = string orig_file_with_path =
MakeAbsPath(orig_file, buf->filePath()); 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 = " lyxerr[Debug::GRAPHICS] << "[InsetGraphics::prepareFile] orig_file = "
<< orig_file << "\n\twith path: " << orig_file << "\n\twith path: "
<< orig_file_with_path << endl; << 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 // No conversion is needed. LaTeX can handle the
// graphic file as is. // graphic file as is.
// This is true even if the orig_file is compressed. // This is true even if the orig_file is compressed.
if (formats.getFormat(to)->extension() == GetExtension(orig_file)) { return orig_file_with_path;
return RemoveExtension(orig_file_with_path);
} else {
return orig_file_with_path;
}
} }
// We're going to be running the exported buffer through the LaTeX // 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) { if (from == to) {
// No conversion is needed. LaTeX can handle the // No conversion is needed. LaTeX can handle the
// graphic file as is. // graphic file as is.
if (formats.getFormat(to)->extension() == GetExtension(orig_file)) return temp_file;
return RemoveExtension(temp_file);
else
return temp_file;
} }
} }
@ -691,7 +693,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const
#endif #endif
} }
return RemoveExtension(temp_file); return ChangeExtension(temp_file, formats.getFormat(to)->extension());
} }