git.iko.soy/typeable/pandoc
on master help sign in
PDF: Use / as path separators in tempdir on Windows.
5040f3eJohn MacFarlane
src/Text/Pandoc/PDF.hs+11−3
@@ -51,13 +51,21 @@ import Text.Pandoc.Options (WriterOptions(..))
51import Text.Pandoc.MIME (extensionFromMimeType)
51import Text.Pandoc.MIME (extensionFromMimeType)
52import Text.Pandoc.Process (pipeProcess)
52import Text.Pandoc.Process (pipeProcess)
53import qualified Data.ByteString.Lazy as BL
53import qualified Data.ByteString.Lazy as BL
54+#ifdef _WINDOWS
55+import Data.List (intercalate)
56+#endif
54
57
55withTempDir :: String -> (FilePath -> IO a) -> IO a
58withTempDir :: String -> (FilePath -> IO a) -> IO a
56−withTempDir =
59+withTempDir f =
57#ifdef _WINDOWS
60#ifdef _WINDOWS
58− withTempDirectory "."
61+ withTempDirectory "." (f . changePathSeparators)
59#else
62#else
60− withSystemTempDirectory
63+ withSystemTempDirectory f
64+#endif
65+
66+#ifdef _WINDOWS
67+changePathSeparators :: FilePath -> FilePath
68+changePathSeparators = intercalate "/" . splitDirectories
61#endif
69#endif
62
70
63makePDF :: String -- ^ pdf creator (pdflatex, lualatex, xelatex)
71makePDF :: String -- ^ pdf creator (pdflatex, lualatex, xelatex)