Return a list of subdirs of a given dir
This commit is contained in:
parent
abbef763e7
commit
ccdd98ca7e
2 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
_ -> []
|
||||
|
|
|
@ -29,7 +29,8 @@ library
|
|||
exposed-modules: Vervis
|
||||
-- other-modules:
|
||||
-- other-extensions:
|
||||
build-depends: base >=4.8 && <5
|
||||
build-depends: base >=4.8 && <5
|
||||
, directory-tree >=0.12
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
|
|
Loading…
Reference in a new issue