Sort directory contents #1684

This commit is contained in:
Michael Snoyman 2020-07-02 19:20:03 +03:00
parent f5a6ccb363
commit 084a3cefb5
No known key found for this signature in database
GPG Key ID: 907EAE2F42B52046
3 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,9 @@
# ChangeLog for yesod-static
## 1.6.1.0
* Support reproducible embedded file order [#1684](https://github.com/yesodweb/yesod/issues/1684#issuecomment-652562514)
## 1.6.0.2 ## 1.6.0.2
* Remove unnecessary deriving of Typeable * Remove unnecessary deriving of Typeable

View File

@ -49,6 +49,7 @@ import qualified System.Process as Proc
import System.Exit (ExitCode (ExitSuccess)) import System.Exit (ExitCode (ExitSuccess))
import Control.Concurrent.Async (Concurrently (..)) import Control.Concurrent.Async (Concurrently (..))
import System.IO (hClose) import System.IO (hClose)
import Data.List (sort)
import Yesod.EmbeddedStatic.Types import Yesod.EmbeddedStatic.Types
@ -80,7 +81,7 @@ getRecursiveContents :: Location -- ^ The directory to search
-> FilePath -- ^ The prefix to add to the filenames -> FilePath -- ^ The prefix to add to the filenames
-> IO [(Location,FilePath)] -> IO [(Location,FilePath)]
getRecursiveContents prefix topdir = do getRecursiveContents prefix topdir = do
names <- getDirectoryContents topdir names <- sort <$> getDirectoryContents topdir
let properNames = filter (`notElem` [".", ".."]) names let properNames = filter (`notElem` [".", ".."]) names
paths <- forM properNames $ \name -> do paths <- forM properNames $ \name -> do
let path = topdir </> name let path = topdir </> name

View File

@ -1,5 +1,5 @@
name: yesod-static name: yesod-static
version: 1.6.0.2 version: 1.6.1.0
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>
@ -7,7 +7,7 @@ maintainer: Michael Snoyman <michael@snoyman.com>, Greg Weber <greg@gregweb
synopsis: Static file serving subsite for Yesod Web Framework. synopsis: Static file serving subsite for Yesod Web Framework.
category: Web, Yesod category: Web, Yesod
stability: Stable stability: Stable
cabal-version: >= 1.8 cabal-version: >= 1.10
build-type: Simple build-type: Simple
homepage: http://www.yesodweb.com/ homepage: http://www.yesodweb.com/
description: API docs and the README are available at <http://www.stackage.org/package/yesod-static> description: API docs and the README are available at <http://www.stackage.org/package/yesod-static>
@ -26,6 +26,7 @@ extra-source-files:
README.md README.md
library library
default-language: Haskell2010
build-depends: base >= 4.10 && < 5 build-depends: base >= 4.10 && < 5
, async , async
, attoparsec >= 0.10 , attoparsec >= 0.10
@ -66,9 +67,10 @@ library
Yesod.EmbeddedStatic.Css.Util Yesod.EmbeddedStatic.Css.Util
ghc-options: -Wall ghc-options: -Wall
extensions: TemplateHaskell other-extensions: TemplateHaskell
test-suite tests test-suite tests
default-language: Haskell2010
hs-source-dirs: ., test hs-source-dirs: ., test
main-is: tests.hs main-is: tests.hs
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
@ -118,7 +120,7 @@ test-suite tests
, rio , rio
ghc-options: -Wall -threaded ghc-options: -Wall -threaded
extensions: TemplateHaskell other-extensions: TemplateHaskell
source-repository head source-repository head
type: git type: git