aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-07-15 11:38:43 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-07-15 11:38:43 +0200
commitdcf79c418801a823f917a97ab1e8461959f0189a (patch)
tree2d92644a1ea5978fea15face38e580efc2d96ce0 /src/Text
parent3871a73e0f2041a956dd69417ebc29b08cd554b8 (diff)
downloadpandoc-dcf79c418801a823f917a97ab1e8461959f0189a.tar.gz
Don't rely on listDirectory, which is only in newer versions...
of directory.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Class.hs7
1 files changed, 5 insertions, 2 deletions
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