aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
diff options
context:
space:
mode:
authorpacien2020-02-16 12:15:08 +0100
committerNotkea2020-02-17 21:07:39 +0100
commit26a85722e74eae23a22350064eed204480bbd032 (patch)
treef5dd1a192ec59a7445f4e83da65cf2ba3e1020ff /compiler/src
parent395a76bc4193c0c7182f87778458a68d0079e836 (diff)
downloadldgallery-26a85722e74eae23a22350064eed204480bbd032.tar.gz
compiler: unify directory special files
Diffstat (limited to 'compiler/src')
-rw-r--r--compiler/src/Input.hs11
1 files changed, 7 insertions, 4 deletions
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
80sidecarExt :: String 80sidecarExt :: String
81sidecarExt = "yaml" 81sidecarExt = "yaml"
82 82
83dirSidecar :: String 83dirPropFile :: String
84dirSidecar = "directory." ++ sidecarExt 84dirPropFile = "_directory"
85
86dirSidecar :: Path
87dirSidecar = Path [dirPropFile] <.> sidecarExt
85 88
86readSidecarFile :: FilePath -> IO Sidecar 89readSidecarFile :: FilePath -> IO Sidecar
87readSidecarFile filepath = 90readSidecarFile filepath =
@@ -111,7 +114,7 @@ readInputTree (AnchoredFSNode anchor root@Dir{}) = mkDirNode root
111 do 114 do
112 dirItems <- mapM mkInputNode items 115 dirItems <- mapM mkInputNode items
113 modTime <- getModificationTime $ localPath (anchor /> path) 116 modTime <- getModificationTime $ localPath (anchor /> path)
114 sidecar <- readSidecarFile $ localPath (anchor /> path </ dirSidecar) 117 sidecar <- readSidecarFile $ localPath (anchor /> path </> dirSidecar)
115 return $ InputDir path modTime sidecar (findThumbnail items) (catMaybes dirItems) 118 return $ InputDir path modTime sidecar (findThumbnail items) (catMaybes dirItems)
116 119
117 isSidecar :: FSNode -> Bool 120 isSidecar :: FSNode -> Bool
@@ -125,7 +128,7 @@ readInputTree (AnchoredFSNode anchor root@Dir{}) = mkDirNode root
125 isThumbnail File{path} = 128 isThumbnail File{path} =
126 fileName path 129 fileName path
127 & fmap dropExtension 130 & fmap dropExtension
128 & (maybe False ("thumbnail" ==)) 131 & (maybe False (dirPropFile ==))
129 132
130 findThumbnail :: [FSNode] -> Maybe Path 133 findThumbnail :: [FSNode] -> Maybe Path
131 findThumbnail = (fmap Files.path) . (find isThumbnail) 134 findThumbnail = (fmap Files.path) . (find isThumbnail)