aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Input.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/Input.hs')
-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)