diff options
-rw-r--r-- | src/Text/Pandoc/PDF.hs | 14 |
1 files changed, 11 insertions, 3 deletions
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) |