git.iko.soy/typeable/pandoc
on master help sign in
Don't rely on listDirectory, which is only in newer versions...

of directory.

commitdcf79c418801a823f917a97ab1e8461959f0189a authorJohn MacFarlane <jgm@berkeley.edu> dateSat 15 Jul 2017, 11:38 (9 years ago) parent3871a73
1 file changed+5−2
src/Text/Pandoc/Class.hs+5−2
src/Text/Pandoc/Class.hs+5−2
@@ -102,7 +102,7 @@ import qualified Data.ByteString as B
102102import qualified Data.ByteString.Lazy as BL
103103import qualified System.Environment as IO (lookupEnv)
104104import System.FilePath.Glob (match, compile)
105−import System.Directory (createDirectoryIfMissing, listDirectory,
105+import System.Directory (createDirectoryIfMissing, getDirectoryContents,
106106 doesDirectoryExist)
107107import System.FilePath ((</>), (<.>), takeDirectory,
108108 takeExtension, dropExtension, isRelative, normalise)
@@ -486,7 +486,10 @@ addToFileTree (FileTree treemap) fp = do
486486 isdir <- doesDirectoryExist fp
487487 if isdir
488488 then do -- recursively add contents of directories
489− fs <- map (fp </>) <$> listDirectory fp
489+ let isSpecial ".." = True
490+ isSpecial "." = True
491+ isSpecial _ = False
492+ fs <- (map (fp </>) . filter (not . isSpecial)) <$> getDirectoryContents fp
490493 foldM addToFileTree (FileTree treemap) fs
491494 else do
492495 contents <- B.readFile fp