diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-01-18 07:01:29 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-01-18 07:01:29 +0000 |
commit | b412a9cf4a3bf841f4fb4fb1bf63590f3c9c43e6 (patch) | |
tree | c2a9d1a07e8e1f534f5b33655b865900b5929c3c /src/Text/Pandoc/Shared.hs | |
parent | 9fed26181f7cc8aa0f3bd2a01332204389c8979c (diff) | |
download | pandoc-b412a9cf4a3bf841f4fb4fb1bf63590f3c9c43e6.tar.gz |
Made user directory a Maybe in readFile, s5HeaderIncludes, laTeXMathML.
This is more uniform, and calling libraries can always disable
searching of user directories for overrides.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1821 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 5657321d8..14086c20f 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -1046,7 +1046,9 @@ inDirectory path action = do -- | Read file from specified user data directory or, if not found there, from -- Cabal data directory. -readDataFile :: FilePath -> FilePath -> IO String -readDataFile userDir fname = catch - (readFile $ userDir </> fname) - (\_ -> getDataFileName fname >>= readFile) +readDataFile :: Maybe FilePath -> FilePath -> IO String +readDataFile userDir fname = + case userDir of + Nothing -> getDataFileName fname >>= readFile + Just u -> catch (readFile $ u </> fname) + (\_ -> getDataFileName fname >>= readFile) |