aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL5
-rw-r--r--src/Text/Pandoc/Shared.hs10
2 files changed, 11 insertions, 4 deletions
diff --git a/INSTALL b/INSTALL
index 8bcea83c2..ba3cb8eb6 100644
--- a/INSTALL
+++ b/INSTALL
@@ -3,7 +3,10 @@
These instructions explain how to install pandoc from source.
Binary packages or ports of pandoc are available for freebsd
and several linux distributions, so check your package manager.
-There is also a Windows installer.
+There are also binary installers for Windows and Mac OS X.
+
+If you are installing the development version from github, see also:
+https://github.com/jgm/pandoc/wiki/Installing-the-development-version-of-pandoc
Quick install
-------------
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index d670a35bc..72b467da5 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -583,8 +583,7 @@ readDefaultDataFile :: FilePath -> IO BS.ByteString
readDefaultDataFile fname =
#ifdef EMBED_DATA_FILES
case lookup (makeCanonical fname) dataFiles of
- Nothing -> ioError $ userError
- $ "Data file `" ++ fname ++ "' does not exist"
+ Nothing -> err 97 $ "Could not find data file " ++ fname
Just contents -> return contents
where makeCanonical = joinPath . transformPathParts . splitDirectories
transformPathParts = reverse . foldl go []
@@ -592,7 +591,12 @@ readDefaultDataFile fname =
go (_:as) ".." = as
go as x = x : as
#else
- getDataFileName ("data" </> fname) >>= BS.readFile
+ getDataFileName ("data" </> fname) >>= checkExistence >>= BS.readFile
+ where checkExistence fn = do
+ exists <- doesFileExist fn
+ if exists
+ then return fn
+ else err 97 ("Could not find data file " ++ fname)
#endif
-- | Read file from specified user data directory or, if not found there, from