From 395a76bc4193c0c7182f87778458a68d0079e836 Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 14 Feb 2020 15:39:56 +0100 Subject: compiler: metadata sidecar for whole directories GitHub: closes #3 --- compiler/src/Input.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compiler/src/Input.hs') diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs index cb837e3..e0fc8ef 100644 --- a/compiler/src/Input.hs +++ b/compiler/src/Input.hs @@ -58,6 +58,7 @@ data InputTree = | InputDir { path :: Path , modTime :: UTCTime + , sidecar :: Sidecar , dirThumbnailPath :: Maybe Path , items :: [InputTree] } deriving Show @@ -79,6 +80,9 @@ emptySidecar = Sidecar sidecarExt :: String sidecarExt = "yaml" +dirSidecar :: String +dirSidecar = "directory." ++ sidecarExt + readSidecarFile :: FilePath -> IO Sidecar readSidecarFile filepath = doesFileExist filepath @@ -107,7 +111,8 @@ readInputTree (AnchoredFSNode anchor root@Dir{}) = mkDirNode root do dirItems <- mapM mkInputNode items modTime <- getModificationTime $ localPath (anchor /> path) - return $ InputDir path modTime (findThumbnail items) (catMaybes dirItems) + sidecar <- readSidecarFile $ localPath (anchor /> path Bool isSidecar Dir{} = False -- cgit v1.2.3