aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Resource.hs
diff options
context:
space:
mode:
authorpacien2019-12-27 10:21:44 +0100
committerpacien2019-12-27 10:21:44 +0100
commit015d793b25a3f0d1ff275ed42ec211dd6a532ca0 (patch)
tree3b6f5b96631c4f8575ce32a0a07b647ebbedc0a4 /compiler/src/Resource.hs
parenteb7a652b2244ffa4dd5ba2440b7879127e7c6078 (diff)
downloadldgallery-015d793b25a3f0d1ff275ed42ec211dd6a532ca0.tar.gz
compiler: fix old resources cleanup
Diffstat (limited to 'compiler/src/Resource.hs')
-rw-r--r--compiler/src/Resource.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs
index dc849cd..83f7438 100644
--- a/compiler/src/Resource.hs
+++ b/compiler/src/Resource.hs
@@ -34,7 +34,7 @@ module Resource
34 34
35 35
36import Data.Function ((&)) 36import Data.Function ((&))
37import Data.List ((\\)) 37import Data.List ((\\), subsequences)
38import Data.Maybe (mapMaybe) 38import Data.Maybe (mapMaybe)
39import Files 39import Files
40import Input (InputTree(..), Sidecar) 40import Input (InputTree(..), Sidecar)
@@ -93,10 +93,14 @@ flattenResourceTree dir@(DirResource items _ _) =
93 dir:(concatMap flattenResourceTree items) 93 dir:(concatMap flattenResourceTree items)
94 94
95outputDiff :: ResourceTree -> FSNode -> [Path] 95outputDiff :: ResourceTree -> FSNode -> [Path]
96outputDiff resources ref = (fsPaths ref) \\ (resPaths $ flattenResourceTree resources) 96outputDiff resources ref =
97 (fsPaths ref) \\ (resPaths $ flattenResourceTree resources)
97 where 98 where
98 resPaths :: [ResourceTree] -> [Path] 99 resPaths :: [ResourceTree] -> [Path]
99 resPaths resList = (map resPath resList) ++ (mapMaybe thumbnailPath resList) 100 resPaths resList = map resPath resList ++ thumbnailPaths resList
101
102 thumbnailPaths :: [ResourceTree] -> [Path]
103 thumbnailPaths = (concatMap subsequences) . (mapMaybe thumbnailPath)
100 104
101 fsPaths :: FSNode -> [Path] 105 fsPaths :: FSNode -> [Path]
102 fsPaths = map nodePath . tail . flattenDir 106 fsPaths = map nodePath . tail . flattenDir