aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-03-10 11:16:09 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-03-10 11:16:50 -0700
commit5040f3ede08188610054ff2afab1c3cd9c16c58a (patch)
tree89fcff6b062f0cba12a3273ed010534026ceabdf /src/Text
parentc026c16fa6d9313dc2aa30e8348176e292dc78e0 (diff)
downloadpandoc-5040f3ede08188610054ff2afab1c3cd9c16c58a.tar.gz
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.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/PDF.hs14
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)