aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-12-29 20:44:09 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-12-29 20:44:09 -0800
commit84ed0f055f71f32fc2db1dbe962e83cd0bb0b5d8 (patch)
tree039cfc46417e6feddb365795b66b71f163223153 /src/Text
parenta00c0344d872c64f46ae940bbd23371dfb41abc0 (diff)
downloadpandoc-84ed0f055f71f32fc2db1dbe962e83cd0bb0b5d8.tar.gz
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.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Shared.hs4
1 files changed, 3 insertions, 1 deletions
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