@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings #-}
1+{-# LANGUAGE OverloadedStrings, CPP #-}
22{-
33Copyright (C) 2012 John MacFarlane <jgm@berkeley.edu>
44
@@ -45,10 +45,18 @@ import Text.Pandoc.UTF8 as UTF8
4545import Control.Monad (unless)
4646import Data.List (isInfixOf)
4747
48+withTempDir :: String -> (FilePath -> IO a) -> IO a
49+withTempDir =
50+#ifdef _WINDOWS
51+ withTempDirectory "."
52+#else
53+ withSystemTempDirectory
54+#endif
55+
4856tex2pdf :: String -- ^ tex program (pdflatex, lualatex, xelatex)
4957 -> String -- ^ latex source
5058 -> IO (Either ByteString ByteString)
51−tex2pdf program source = withSystemTempDirectory "tex2pdf" $ \tmpdir ->
59+tex2pdf program source = withTempDir "tex2pdf." $ \tmpdir ->
5260 tex2pdf' tmpdir program source
5361
5462tex2pdf' :: FilePath -- ^ temp directory for output