From dcf79c418801a823f917a97ab1e8461959f0189a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 15 Jul 2017 11:38:43 +0200 Subject: Don't rely on listDirectory, which is only in newer versions... of directory. --- src/Text/Pandoc/Class.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs index 63b7419c4..f83683d4c 100644 --- a/src/Text/Pandoc/Class.hs +++ b/src/Text/Pandoc/Class.hs @@ -102,7 +102,7 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import qualified System.Environment as IO (lookupEnv) import System.FilePath.Glob (match, compile) -import System.Directory (createDirectoryIfMissing, listDirectory, +import System.Directory (createDirectoryIfMissing, getDirectoryContents, doesDirectoryExist) import System.FilePath ((), (<.>), takeDirectory, takeExtension, dropExtension, isRelative, normalise) @@ -486,7 +486,10 @@ addToFileTree (FileTree treemap) fp = do isdir <- doesDirectoryExist fp if isdir then do -- recursively add contents of directories - fs <- map (fp ) <$> listDirectory fp + let isSpecial ".." = True + isSpecial "." = True + isSpecial _ = False + fs <- (map (fp ) . filter (not . isSpecial)) <$> getDirectoryContents fp foldM addToFileTree (FileTree treemap) fs else do contents <- B.readFile fp -- cgit v1.2.3