diff options
| author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2015-09-11 20:48:45 -0400 |
|---|---|---|
| committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2015-09-11 20:48:45 -0400 |
| commit | 6768e16cfcc471674b0a65581cf1ea90ec2e6b98 (patch) | |
| tree | fb877bc41d18c5b0b8dc1d74703bde9acd237446 /src/PhotoStore.hs | |
Basic functionality to list directories.
Diffstat (limited to 'src/PhotoStore.hs')
| -rw-r--r-- | src/PhotoStore.hs | 20 |
1 files changed, 20 insertions, 0 deletions
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]) |
