fix (again and hopefully for the last time :-) ) graphics filenames with spaces (bug 1913)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@10121 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2005-07-04 11:26:42 +00:00
parent fcf3fe8787
commit e7706db6b2
5 changed files with 24 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2005-07-04 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* insetgraphics.C (latex): Put the extension outside the quotes
2005-06-24 Georg Baum <Georg.Baum@post.rwth-aachen.de> 2005-06-24 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* insetgraphics.C (prepareFile): replace spaces in filenames with _ * insetgraphics.C (prepareFile): replace spaces in filenames with _

View File

@ -779,7 +779,7 @@ int InsetGraphics::latex(Buffer const *buf, ostream & os,
buf->filePath()), buf->filePath()),
m_buffer->filePath()); m_buffer->filePath());
} }
latex_str += latex_path(fname); latex_str += latex_path(fname, true);
} }
latex_str += '}' + after; latex_str += '}' + after;

View File

@ -1,3 +1,7 @@
2005-07-04 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* filetools.[Ch] (latex_path): add exclude_extension argument
2005-06-21 Georg Baum <Georg.Baum@post.rwth-aachen.de> 2005-06-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* filetools.C (latex_path): protect " with \string since it may be * filetools.C (latex_path): protect " with \string since it may be

View File

@ -91,13 +91,20 @@ bool IsSGMLFilename(string const & filename)
} }
string const latex_path(string const & original_path) string const latex_path(string const & original_path, bool exclude_extension)
{ {
string path = subst(original_path, "~", "\\string~"); string path = subst(original_path, "~", "\\string~");
if (path.find(' ') != string::npos) if (path.find(' ') != string::npos)
// We can't use '"' because " is sometimes active (e.g. if // We can't use '"' because " is sometimes active (e.g. if
// babel is loaded with the "german" option) // babel is loaded with the "german" option)
path = "\\string\"" + path + "\\string\""; if (exclude_extension) {
string const base = ChangeExtension(path, string());
string const ext = GetExtension(path);
path = ChangeExtension(
"\\string\"" + base + "\\string\"", ext);
} else
path = "\\string\"" + path + "\\string\"";
return path; return path;
} }

View File

@ -146,8 +146,13 @@ bool PutEnvPath(string const & envstr);
* If @c path contains spaces, then the returned path is enclosed in * If @c path contains spaces, then the returned path is enclosed in
* "-quotes. This last fix will lead to successful compiliation of the * "-quotes. This last fix will lead to successful compiliation of the
* LaTeX file only if a sufficiently modern LaTeX compiler is used. * LaTeX file only if a sufficiently modern LaTeX compiler is used.
* If @c exclude_extension is true the extension is left outside the quotes.
* This is needed for pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
* (format=pdflatex 2005.4.11) in combination with
* pdftex.def 2002/06/19 v0.03k graphics/color for pdftex:
* It does not recognize the file extension if it is inside the quotes.
*/ */
string const latex_path(string const & path); string const latex_path(string const & path, bool exclude_extension = false);
/// Substitutes active latex characters with underscores in filename /// Substitutes active latex characters with underscores in filename
string const MakeLatexName(string const & file); string const MakeLatexName(string const & file);