git.iko.soy/typeable/file-embed
on master help sign in
Directory listings are sorted yesodweb/yesod#1684
commita3c24307c864a556072f1e1f4315292d79ede6fc authorMichael Snoyman <michael@snoyman.com> dateWed 1 Jul 2020, 10:41 (6 years ago) parent60a0adc
4 files changed+10−4
ChangeLog.md+4 Data/FileEmbed.hs+3−1 file-embed.cabal+1−1 test/main.hs+2−2
ChangeLog.md+4
@@ -1,5 +1,9 @@
11# ChangeLog for file-embed
22
3+## 0.0.13.0
4+
5+* Ensure that directory listings are returned in sorted order for reproducibility [yesodweb/yesod#1684](https://github.com/yesodweb/yesod/issues/1684)
6+
37## 0.0.12.0
48
59* Use the `Bytes` literal on newer GHCs to reduce memory usage during compilation [#36](https://github.com/snoyberg/file-embed/pull/36)
Data/FileEmbed.hs+3−1
@@ -71,6 +71,8 @@ import System.IO.Unsafe (unsafePerformIO)
7171import System.FilePath ((</>), takeDirectory, takeExtension)
7272import Data.String (fromString)
7373import Prelude as P
74+import Data.List (sortBy)
75+import Data.Ord (comparing)
7476
7577-- | Embed a single file in your source code.
7678--
@@ -234,7 +236,7 @@ fileList' realTop top = do
234236 mapM (liftPair2 . second B.readFile)
235237 dirs <- filterM (doesDirectoryExist . snd) all' >>=
236238 mapM (fileList' realTop . fst)
237− return $ concat $ files : dirs
239+ return $ sortBy (comparing fst) $ concat $ files : dirs
238240
239241liftPair2 :: Monad m => (a, m b) -> m (a, b)
240242liftPair2 (a, b) = b >>= \b' -> return (a, b')
file-embed.cabal+1−1
@@ -1,5 +1,5 @@
11name: file-embed
2−version: 0.0.12.0
2+version: 0.0.13.0
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
test/main.hs+2−2
@@ -14,8 +14,8 @@ main :: IO ()
1414main = do
1515 let received = $(embedDir "test/sample")
1616 received @?=
17− [ ("foo", "foo\r\n")
18− , ("bar" </> "baz", "baz\r\n")
17+ [ ("bar" </> "baz", "baz\r\n")
18+ , ("foo", "foo\r\n")
1919 ]
2020 let str = $(embedStringFile "test/sample/foo") :: String
2121 filter (/= '\r') str @?= "foo\n"