summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Data.hsb5
-rw-r--r--src/Text/Pandoc/Shared.hs11
2 files changed, 4 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Data.hsb b/src/Text/Pandoc/Data.hsb
index cd8836a0b..3a0bf8ac4 100644
--- a/src/Text/Pandoc/Data.hsb
+++ b/src/Text/Pandoc/Data.hsb
@@ -4,7 +4,4 @@ module Text.Pandoc.Data (dataFiles) where
import qualified Data.ByteString as B
dataFiles :: [(FilePath, B.ByteString)]
-dataFiles = %blobs "data"
-
-readmeFile :: B.ByteString
-readmeFile = %blob "README"
+dataFiles = ("README", %blob "README") : %blobs "data" \ No newline at end of file
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 2090e1734..7a4753327 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -132,7 +132,7 @@ import qualified Data.Text as T (toUpper, pack, unpack)
import Data.ByteString.Lazy (toChunks)
#ifdef EMBED_DATA_FILES
-import Text.Pandoc.Data (dataFiles, readmeFile)
+import Text.Pandoc.Data (dataFiles)
#else
import Paths_pandoc (getDataFileName)
#endif
@@ -743,12 +743,6 @@ inDirectory path action = E.bracket
(const $ setCurrentDirectory path >> action)
readDefaultDataFile :: FilePath -> IO BS.ByteString
-readDefaultDataFile "README" =
-#ifdef EMBED_DATA_FILES
- return readmeFile
-#else
- getDataFileName "README" >>= checkExistence >>= BS.readFile
-#endif
readDefaultDataFile fname =
#ifdef EMBED_DATA_FILES
case lookup (makeCanonical fname) dataFiles of
@@ -760,7 +754,8 @@ readDefaultDataFile fname =
go (_:as) ".." = as
go as x = x : as
#else
- getDataFileName ("data" </> fname) >>= checkExistence >>= BS.readFile
+ getDataFileName fname' >>= checkExistence >>= BS.readFile
+ where fname' = if fname == "README" then fname else "data" </> fname
#endif
checkExistence :: FilePath -> IO FilePath