diff options
author | pacien | 2020-02-16 12:15:08 +0100 |
---|---|---|
committer | Notkea | 2020-02-17 21:07:39 +0100 |
commit | 26a85722e74eae23a22350064eed204480bbd032 (patch) | |
tree | f5dd1a192ec59a7445f4e83da65cf2ba3e1020ff /compiler | |
parent | 395a76bc4193c0c7182f87778458a68d0079e836 (diff) | |
download | ldgallery-26a85722e74eae23a22350064eed204480bbd032.tar.gz |
compiler: unify directory special files
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/Input.hs | 11 |
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 | |||
80 | sidecarExt :: String | 80 | sidecarExt :: String |
81 | sidecarExt = "yaml" | 81 | sidecarExt = "yaml" |
82 | 82 | ||
83 | dirSidecar :: String | 83 | dirPropFile :: String |
84 | dirSidecar = "directory." ++ sidecarExt | 84 | dirPropFile = "_directory" |
85 | |||
86 | dirSidecar :: Path | ||
87 | dirSidecar = Path [dirPropFile] <.> sidecarExt | ||
85 | 88 | ||
86 | readSidecarFile :: FilePath -> IO Sidecar | 89 | readSidecarFile :: FilePath -> IO Sidecar |
87 | readSidecarFile filepath = | 90 | readSidecarFile 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) |