From 7f4b78c06458861624305c5f574df206d82f78c2 Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Sat, 17 Oct 2015 22:03:12 -0700 Subject: [PATCH] Text.Pandoc.Data: store paths in dataFiles using posix separators. This way we have uniform separators, whether on Windows or Linux. This should solve a problem where on some Windows versions the data files weren't being found. Closes #2459. --- src/Text/Pandoc/Data.hsb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Data.hsb b/src/Text/Pandoc/Data.hsb index 3a0bf8ac4..d408bf510 100644 --- a/src/Text/Pandoc/Data.hsb +++ b/src/Text/Pandoc/Data.hsb @@ -2,6 +2,14 @@ -- to be processed using hsb2hs module Text.Pandoc.Data (dataFiles) where import qualified Data.ByteString as B +import System.FilePath (splitDirectories) +import qualified System.FilePath.Posix as Posix +-- We ensure that the data files are stored using Posix +-- path separators (/), even on Windows. dataFiles :: [(FilePath, B.ByteString)] -dataFiles = ("README", %blob "README") : %blobs "data" \ No newline at end of file +dataFiles = map (\(fp, contents) -> + (Posix.joinPath (splitDirectories fp), contents)) dataFiles' + +dataFiles' :: [(FilePath, B.ByteString)] +dataFiles' = ("README", %blob "README") : %blobs "data"