From 6768e16cfcc471674b0a65581cf1ea90ec2e6b98 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Fri, 11 Sep 2015 20:48:45 -0400 Subject: Basic functionality to list directories. --- src/PhotoStore.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/PhotoStore.hs (limited to 'src/PhotoStore.hs') diff --git a/src/PhotoStore.hs b/src/PhotoStore.hs new file mode 100644 index 0000000..57b2ccc --- /dev/null +++ b/src/PhotoStore.hs @@ -0,0 +1,20 @@ +module PhotoStore where + +import Data +import System.Directory + +data Config = Config + { pendingPath :: String + , photosPath :: String + } + +validAlbumName name = + name /= "." + && name /= ".." + +getAlbums :: Config -> IO [Album] +getAlbums config = do + pending <- getDirectoryContents (pendingPath config) + permanent <- getDirectoryContents (photosPath config) + return ([Album name True | name <- filter validAlbumName pending] ++ + [Album name False | name <- filter validAlbumName permanent]) -- cgit v1.2.3