From 5b35285daa62fb9c10280fb43e340ba7b0746f5a Mon Sep 17 00:00:00 2001 From: pacien Date: Wed, 25 Dec 2019 22:48:34 +0100 Subject: compiler: add gallery config file handling --- compiler/src/Input.hs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'compiler/src/Input.hs') diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs index 78622bf..fa36d59 100644 --- a/compiler/src/Input.hs +++ b/compiler/src/Input.hs @@ -20,7 +20,8 @@ module Input - ( Sidecar, title, date, description, tags + ( decodeYamlFile + , Sidecar, title, date, description, tags , InputTree(..), readInputTree ) where @@ -42,12 +43,10 @@ import Utils data LoadException = LoadException String ParseException deriving Show instance Exception LoadException -decodeYamlFile :: (MonadIO m, FromJSON a) => Path -> m a +decodeYamlFile :: (MonadIO m, FromJSON a) => FileName -> m a decodeYamlFile path = - liftIO $ Data.Yaml.decodeFileEither fpath - >>= either (throwIO . LoadException fpath) return - where - fpath = localPath path + liftIO $ Data.Yaml.decodeFileEither path + >>= either (throwIO . LoadException path) return -- | Tree representing the input from the input directory. @@ -75,7 +74,7 @@ readInputTree (AnchoredFSNode anchor root@Dir{}) = where mkInputNode :: FSNode -> IO (Maybe InputTree) mkInputNode (File path@(filename:pathto)) | ".yaml" `isExtensionOf` filename = - decodeYamlFile (anchor /> path) + decodeYamlFile (localPath $ anchor /> path) >>= return . InputFile ((dropExtension filename):pathto) >>= return . Just mkInputNode File{} = return Nothing -- cgit v1.2.3