summaryrefslogtreecommitdiff
path: root/Limit.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-02-11 11:47:53 -0400
committerJoey Hess <joey@kitenet.net>2013-02-11 11:47:53 -0400
commit521398cc3d1e06d9d210f5264587bc11657f4141 (patch)
tree40170b1a811f39d7a47fb4c70e4f487fdc4f336a /Limit.hs
parenta86fe5ae9407e7725969dfbf5745fa56c5797883 (diff)
Now uses the Haskell Glob library, rather than pcre-light, avoiding the need to install libpcre. Currently done only for Cabal or when the Makefile is made to use -DWITH_GLOB
Diffstat (limited to 'Limit.hs')
-rw-r--r--Limit.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Limit.hs b/Limit.hs
index 85cce4f444..16e555bed6 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -12,7 +12,9 @@ module Limit where
import Data.Time.Clock.POSIX
import qualified Data.Set as S
import qualified Data.Map as M
-#ifndef WITH_ANDROID
+#ifdef WITH_GLOB
+import System.FilePath.Glob (simplify, compile, match)
+#else
import Text.Regex.PCRE.Light.Char8
import System.Path.WildMatch
#endif
@@ -85,10 +87,12 @@ limitExclude :: MkLimit
limitExclude glob = Right $ const $ return . not . matchglob glob
matchglob :: String -> Annex.FileInfo -> Bool
-#ifdef WITH_ANDROID
-matchglob _ _ = error "glob matching not supported"
-#else
matchglob glob (Annex.FileInfo { Annex.matchFile = f }) =
+#ifdef WITH_GLOB
+ match pattern f
+ where
+ pattern = simplify $ compile glob
+#else
isJust $ match cregex f []
where
cregex = compile regex []