git.iko.soy/typeable/pandoc
on master help sign in
PDF: Use / as path separators in tempdir on Windows.

This is needed for texlive. Note that the / is used only in the body of withTempDir, so when the directory is deleted, the original separators will be used. See #1151.

commit5040f3ede08188610054ff2afab1c3cd9c16c58a authorJohn MacFarlane <fiddlosopher@gmail.com> dateMon 10 Mar 2014, 11:16 (13 years ago) parentc026c16
1 file changed+11−3
src/Text/Pandoc/PDF.hs+11−3
src/Text/Pandoc/PDF.hs+11−3
@@ -51,13 +51,21 @@ import Text.Pandoc.Options (WriterOptions(..))
5151import Text.Pandoc.MIME (extensionFromMimeType)
5252import Text.Pandoc.Process (pipeProcess)
5353import qualified Data.ByteString.Lazy as BL
54+#ifdef _WINDOWS
55+import Data.List (intercalate)
56+#endif
5457
5558withTempDir :: String -> (FilePath -> IO a) -> IO a
56−withTempDir =
59+withTempDir f =
5760#ifdef _WINDOWS
58− withTempDirectory "."
61+ withTempDirectory "." (f . changePathSeparators)
5962#else
60− withSystemTempDirectory
63+ withSystemTempDirectory f
64+#endif
65+
66+#ifdef _WINDOWS
67+changePathSeparators :: FilePath -> FilePath
68+changePathSeparators = intercalate "/" . splitDirectories
6169#endif
6270
6371makePDF :: String -- ^ pdf creator (pdflatex, lualatex, xelatex)