From 84ed0f055f71f32fc2db1dbe962e83cd0bb0b5d8 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 29 Dec 2012 20:44:09 -0800 Subject: Workaround for problem with file-embed. file-embed uses forward slashes as path separators, even on Windows. So we just convert backslashes to forward before doing a lookup. --- src/Text/Pandoc/Shared.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 7bd35b138..8626a91c7 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -512,10 +512,12 @@ dataFiles = $(embedDir "data") readDefaultDataFile :: FilePath -> IO B.ByteString readDefaultDataFile fname = #ifdef EMBED_DATA_FILES - case lookup fname dataFiles of + case lookup (map backToForwardSlash fname) dataFiles of Nothing -> ioError $ userError $ "Data file `" ++ fname ++ "' does not exist" Just contents -> return contents + where backToForwardSlash '\\' = '/' + backToForwardSlash c = c #else getDataFileName ("data" fname) >>= B.readFile #endif -- cgit v1.2.3