]> git.lyx.org Git - lyx.git/blobdiff - src/support/filetools.h
forward port latex_path quoting fix from 1.3
[lyx.git] / src / support / filetools.h
index bdba4bca59af029411e608d6764652f2b6e90088..fba202e24f3b0fc530708d9e9e62532e588bfd8e 100644 (file)
@@ -77,12 +77,10 @@ bool IsLyXFilename(std::string const & filename);
 bool IsSGMLFilename(std::string const & filename);
 
 /** Returns the path of a library data file.
-  Search the file name.ext in the subdirectory dir of
-  \begin{enumerate}
-    \item user_lyxdir
-    \item build_lyxdir (if not empty)
-    \item system_lyxdir
-  \end{enumerate}
+    Search the file name.ext in the subdirectory dir of
+      -# user_lyxdir
+      -# build_lyxdir (if not empty)
+      -# system_lyxdir
     The third parameter `ext' is optional.
 */
 std::string const LibFileSearch(std::string const & dir, std::string const & name,
@@ -104,6 +102,25 @@ i18nLibFileSearch(std::string const & dir, std::string const & name,
  */
 std::string const LibScriptSearch(std::string const & command);
 
+/** @param path a file path in internal_path format. Ie, directories
+ *  are indicated by '/', not by '\'.
+ *
+ *  Manipulates @c path into a form suitable for inclusion in a LaTeX
+ *  document.
+ *  If @c path contains LaTeX special characters, these are escaped.
+ *  Eg, '~' -> '\\string~'
+ *  If @c path contains spaces, then the returned path is enclosed in
+ *  "-quotes. This last fix will lead to successful compiliation of the
+ *  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.
+ */
+std::string const latex_path(std::string const & path,
+                             bool exclude_extension = false)
+
 /// Substitutes active latex characters with underscores in filename
 std::string const MakeLatexName(std::string const & file);