From 7bbb0073595ad7250317c3a348b70d3a3f948a99 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 28 Jun 2015 20:59:18 -0700 Subject: Minor fixes to previous commit. * Instead of defining readmeFile in Text.Pandoc.Data (which we forgot to export anyway), we simply add a record for "README" to the `dataFiles` lookup table. This allows simplifying some of the code for `readDefaultDataFile` in SHared. * As a bonus, `pandoc --print-default-data-file README` now works. --- src/Text/Pandoc/Shared.hs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/Text/Pandoc/Shared.hs') 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 -- cgit v1.2.3