git.iko.soy/typeable/pandoc
on master help sign in
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.

commit84ed0f055f71f32fc2db1dbe962e83cd0bb0b5d8 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 29 Dec 2012, 20:44 (14 years ago) parenta00c034
1 file changed+3−1
src/Text/Pandoc/Shared.hs+3−1
src/Text/Pandoc/Shared.hs+3−1
@@ -512,10 +512,12 @@ dataFiles = $(embedDir "data")
512512readDefaultDataFile :: FilePath -> IO B.ByteString
513513readDefaultDataFile fname =
514514#ifdef EMBED_DATA_FILES
515− case lookup fname dataFiles of
515+ case lookup (map backToForwardSlash fname) dataFiles of
516516 Nothing -> ioError $ userError
517517 $ "Data file `" ++ fname ++ "' does not exist"
518518 Just contents -> return contents
519+ where backToForwardSlash '\\' = '/'
520+ backToForwardSlash c = c
519521#else
520522 getDataFileName ("data" </> fname) >>= B.readFile
521523#endif