From 26a85722e74eae23a22350064eed204480bbd032 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 16 Feb 2020 12:15:08 +0100 Subject: compiler: unify directory special files --- compiler/src/Input.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'compiler/src') diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs index e0fc8ef..75d1ed3 100644 --- a/compiler/src/Input.hs +++ b/compiler/src/Input.hs @@ -80,8 +80,11 @@ emptySidecar = Sidecar sidecarExt :: String sidecarExt = "yaml" -dirSidecar :: String -dirSidecar = "directory." ++ sidecarExt +dirPropFile :: String +dirPropFile = "_directory" + +dirSidecar :: Path +dirSidecar = Path [dirPropFile] <.> sidecarExt readSidecarFile :: FilePath -> IO Sidecar readSidecarFile filepath = @@ -111,7 +114,7 @@ readInputTree (AnchoredFSNode anchor root@Dir{}) = mkDirNode root do dirItems <- mapM mkInputNode items modTime <- getModificationTime $ localPath (anchor /> path) - sidecar <- readSidecarFile $ localPath (anchor /> path path dirSidecar) return $ InputDir path modTime sidecar (findThumbnail items) (catMaybes dirItems) isSidecar :: FSNode -> Bool @@ -125,7 +128,7 @@ readInputTree (AnchoredFSNode anchor root@Dir{}) = mkDirNode root isThumbnail File{path} = fileName path & fmap dropExtension - & (maybe False ("thumbnail" ==)) + & (maybe False (dirPropFile ==)) findThumbnail :: [FSNode] -> Maybe Path findThumbnail = (fmap Files.path) . (find isThumbnail) -- cgit v1.2.3