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.
This commit is contained in:
John MacFarlane 2012-12-29 20:44:09 -08:00
parent a00c0344d8
commit 84ed0f055f

View file

@ -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