git.iko.soy/typeable/pandoc
on master help sign in
PDF: On Windows, create temdir in working directory.

Reason: the path to the system temp directory may contain tildes, which causes problems in LaTeX when the username is more than eight characters. Closes #777.

commit26fefa040a7046bbe00e3caf2597f33e65af5986 authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 26 Apr 2013, 20:33 (13 years ago) parentfdd5f26
2 files changed+12−2
pandoc.cabal+2 src/Text/Pandoc/PDF.hs+10−2
pandoc.cabal+2
@@ -358,6 +358,8 @@ Executable pandoc
358358 Ghc-Prof-Options: -auto-all -caf-all -rtsopts
359359 else
360360 Ghc-Prof-Options: -auto-all -caf-all
361+ if os(windows)
362+ Cpp-options: -D_WINDOWS
361363 Default-Language: Haskell98
362364 Default-Extensions: CPP
363365 Other-Extensions: PatternGuards, OverloadedStrings,
src/Text/Pandoc/PDF.hs+10−2
@@ -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