diff options
author | pacien | 2019-12-27 15:40:50 +0100 |
---|---|---|
committer | pacien | 2019-12-27 15:40:50 +0100 |
commit | e324f3b776e24a441e2b436da95629f0eadaed3f (patch) | |
tree | 1e400797ad67e1acad3b9907a93d999fd3a4a662 | |
parent | a8cdc6eba4ba496bec816dcb7f3c2c0f5114f4c8 (diff) | |
download | ldgallery-e324f3b776e24a441e2b436da95629f0eadaed3f.tar.gz |
compiler: make extension case insensitive
-rw-r--r-- | compiler/src/Processors.hs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs index c097db7..7bf1e36 100644 --- a/compiler/src/Processors.hs +++ b/compiler/src/Processors.hs | |||
@@ -35,6 +35,7 @@ module Processors | |||
35 | import Control.Exception (throwIO) | 35 | import Control.Exception (throwIO) |
36 | import Data.Function ((&)) | 36 | import Data.Function ((&)) |
37 | import Data.Ratio ((%)) | 37 | import Data.Ratio ((%)) |
38 | import Data.Char (toLower) | ||
38 | 39 | ||
39 | import GHC.Generics (Generic) | 40 | import GHC.Generics (Generic) |
40 | import Data.Aeson (FromJSON) | 41 | import Data.Aeson (FromJSON) |
@@ -56,14 +57,16 @@ data Format = | |||
56 | | Other | 57 | | Other |
57 | 58 | ||
58 | formatFromExt :: String -> Format | 59 | formatFromExt :: String -> Format |
59 | formatFromExt ".bmp" = Bmp | 60 | formatFromExt = aux . (map toLower) |
60 | formatFromExt ".jpg" = Jpg | 61 | where |
61 | formatFromExt ".jpeg" = Jpg | 62 | aux ".bmp" = Bmp |
62 | formatFromExt ".png" = Png | 63 | aux ".jpg" = Jpg |
63 | formatFromExt ".tiff" = Tiff | 64 | aux ".jpeg" = Jpg |
64 | formatFromExt ".hdr" = Hdr | 65 | aux ".png" = Png |
65 | formatFromExt ".gif" = Gif | 66 | aux ".tiff" = Tiff |
66 | formatFromExt _ = Other | 67 | aux ".hdr" = Hdr |
68 | aux ".gif" = Gif | ||
69 | aux _ = Other | ||
67 | 70 | ||
68 | data Resolution = Resolution | 71 | data Resolution = Resolution |
69 | { width :: Int | 72 | { width :: Int |