mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-28 12:04:53 +09:00
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
|
module Vervis
|
||||||
(
|
( subdirs
|
||||||
)
|
)
|
||||||
where
|
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
|
||||||
|
_ -> []
|
||||||
|
|
|
@ -30,6 +30,7 @@ library
|
||||||
-- other-modules:
|
-- other-modules:
|
||||||
-- other-extensions:
|
-- other-extensions:
|
||||||
build-depends: base >=4.8 && <5
|
build-depends: base >=4.8 && <5
|
||||||
|
, directory-tree >=0.12
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
Loading…
Reference in a new issue