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.
This commit is contained in:
John MacFarlane 2014-03-10 11:16:09 -07:00
parent c026c16fa6
commit 5040f3ede0

View file

@ -51,13 +51,21 @@ import Text.Pandoc.Options (WriterOptions(..))
import Text.Pandoc.MIME (extensionFromMimeType)
import Text.Pandoc.Process (pipeProcess)
import qualified Data.ByteString.Lazy as BL
#ifdef _WINDOWS
import Data.List (intercalate)
#endif
withTempDir :: String -> (FilePath -> IO a) -> IO a
withTempDir =
withTempDir f =
#ifdef _WINDOWS
withTempDirectory "."
withTempDirectory "." (f . changePathSeparators)
#else
withSystemTempDirectory
withSystemTempDirectory f
#endif
#ifdef _WINDOWS
changePathSeparators :: FilePath -> FilePath
changePathSeparators = intercalate "/" . splitDirectories
#endif
makePDF :: String -- ^ pdf creator (pdflatex, lualatex, xelatex)