mirror of
https://github.com/typeable/file-embed.git
synced 2024-08-15 18:50:29 +03:00
Directory listings are sorted yesodweb/yesod#1684
This commit is contained in:
parent
60a0adc5e5
commit
a3c24307c8
@ -1,5 +1,9 @@
|
||||
# ChangeLog for file-embed
|
||||
|
||||
## 0.0.13.0
|
||||
|
||||
* Ensure that directory listings are returned in sorted order for reproducibility [yesodweb/yesod#1684](https://github.com/yesodweb/yesod/issues/1684)
|
||||
|
||||
## 0.0.12.0
|
||||
|
||||
* Use the `Bytes` literal on newer GHCs to reduce memory usage during compilation [#36](https://github.com/snoyberg/file-embed/pull/36)
|
||||
|
@ -71,6 +71,8 @@ import System.IO.Unsafe (unsafePerformIO)
|
||||
import System.FilePath ((</>), takeDirectory, takeExtension)
|
||||
import Data.String (fromString)
|
||||
import Prelude as P
|
||||
import Data.List (sortBy)
|
||||
import Data.Ord (comparing)
|
||||
|
||||
-- | Embed a single file in your source code.
|
||||
--
|
||||
@ -234,7 +236,7 @@ fileList' realTop top = do
|
||||
mapM (liftPair2 . second B.readFile)
|
||||
dirs <- filterM (doesDirectoryExist . snd) all' >>=
|
||||
mapM (fileList' realTop . fst)
|
||||
return $ concat $ files : dirs
|
||||
return $ sortBy (comparing fst) $ concat $ files : dirs
|
||||
|
||||
liftPair2 :: Monad m => (a, m b) -> m (a, b)
|
||||
liftPair2 (a, b) = b >>= \b' -> return (a, b')
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: file-embed
|
||||
version: 0.0.12.0
|
||||
version: 0.0.13.0
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
|
@ -14,8 +14,8 @@ main :: IO ()
|
||||
main = do
|
||||
let received = $(embedDir "test/sample")
|
||||
received @?=
|
||||
[ ("foo", "foo\r\n")
|
||||
, ("bar" </> "baz", "baz\r\n")
|
||||
[ ("bar" </> "baz", "baz\r\n")
|
||||
, ("foo", "foo\r\n")
|
||||
]
|
||||
let str = $(embedStringFile "test/sample/foo") :: String
|
||||
filter (/= '\r') str @?= "foo\n"
|
||||
|
Loading…
Reference in New Issue
Block a user