Return a list of subdirs of a given dir

This commit is contained in:
fr33domlover 2016-01-28 15:37:04 +00:00
parent abbef763e7
commit ccdd98ca7e
2 changed files with 16 additions and 2 deletions

View file

@ -14,6 +14,19 @@
-}
module Vervis
(
( subdirs
)
where
import Data.Maybe (mapMaybe)
import System.Directory.Tree
subdirs :: FilePath -> IO [FilePath]
subdirs dir = do
_base :/ tree <- buildL dir
return $ case tree of
Dir _ cs ->
let dirName (Dir n _) = Just n
dirName _ = Nothing
in mapMaybe dirName cs
_ -> []

View file

@ -30,6 +30,7 @@ library
-- other-modules:
-- other-extensions:
build-depends: base >=4.8 && <5
, directory-tree >=0.12
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall