{-# LANGUAGE NamedFieldPuns #-} module Blog.Path ( Path(..) , build ) where import Arguments (Arguments) import qualified Arguments as Arguments (Arguments(..)) import Files (File(..), absolute, filePath) data Path = Path { articlesPath :: FilePath , commentsAt :: Maybe String , pagesPath :: Maybe FilePath , root :: FilePath } build :: Arguments -> IO Path build arguments = do articlesPath <- filePath . Dir $ Arguments.articlesPath arguments pagesPath <- mapM (filePath . Dir) $ Arguments.pagesPath arguments root <- absolute . Dir $ Arguments.sourceDir arguments return $ Path { articlesPath, commentsAt = Arguments.commentsAt arguments, pagesPath, root }