Skip to content

Commit

Permalink
Use doesPathExist when available in System.FSNotify.Path
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Feb 11, 2021
1 parent 7469f50 commit 4bb7d27
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/System/FSNotify/Path.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
-- Copyright (c) 2012 Mark Dittmer - http://www.markdittmer.org
-- Developed for a Google Summer of Code project - http://gsoc2012.markdittmer.org
--
{-# LANGUAGE MultiParamTypeClasses, TypeSynonymInstances, FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE CPP #-}

module System.FSNotify.Path
( findFiles
Expand All @@ -24,7 +27,11 @@ getDirectoryContentsPath :: FilePath -> IO [FilePath]
getDirectoryContentsPath path =
((map (path </>)) . filter (not . dots) <$> D.getDirectoryContents path) >>= filterM exists
where
#if MIN_VERSION_directory(1, 2, 7)
exists x = D.doesPathExist x
#else
exists x = (||) <$> D.doesFileExist x <*> D.doesDirectoryExist x
#endif
dots "." = True
dots ".." = True
dots _ = False
Expand Down

0 comments on commit 4bb7d27

Please sign in to comment.