From 5040f3ede08188610054ff2afab1c3cd9c16c58a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 10 Mar 2014 11:16:09 -0700 Subject: 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. --- src/Text/Pandoc/PDF.hs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index 06e4d2aae..4dfa1d827 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -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) -- cgit v1.2.3