mirror of https://github.com/voidlizard/hbs2
wip, rewrite glob, slow
This commit is contained in:
parent
a90a97a5a7
commit
91a9739ca7
|
@ -33,14 +33,14 @@ glob pat ignore dir action = do
|
||||||
[] -> pure ()
|
[] -> pure ()
|
||||||
(p:rest) -> do
|
(p:rest) -> do
|
||||||
isD <- liftIO (doesDirectoryExist p)
|
isD <- liftIO (doesDirectoryExist p)
|
||||||
if isD && not (skip p) then do
|
if isD && not (skip p) then do
|
||||||
content <- liftIO (try @_ @IOError $ listDirectory p)
|
content <- liftIO (try @_ @IOError $ listDirectory p)
|
||||||
<&> fromRight mempty
|
<&> fromRight mempty
|
||||||
let found = [ p </> x | x <- content ]
|
let found = [ p </> x | x <- content ]
|
||||||
next (rest <> found)
|
next (rest <> found)
|
||||||
else do
|
else do
|
||||||
isF <- liftIO (doesFileExist p)
|
isF <- liftIO (doesFileExist p)
|
||||||
when (matches pat p && not (skip p) ) do
|
when (isF && matches pat p ) do
|
||||||
void $ action p
|
void $ action p
|
||||||
next rest
|
next rest
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue