packages feed

file-embed 0.0.14.0 → 0.0.15.0

raw patch · 3 files changed

+21/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.FileEmbed: makeRelativeToLocationPredicate :: (FilePath -> Bool) -> FilePath -> Q FilePath

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # ChangeLog for file-embed +## 0.0.15.0++* Add `makeRelativeToLocationPredicate`+ ## 0.0.14.0  * Add `embedFileIfExists`
Data/FileEmbed.hs view
@@ -39,6 +39,7 @@     , injectFileWith       -- * Relative path manipulation     , makeRelativeToProject+    , makeRelativeToLocationPredicate       -- * Internal     , stringToBs     , bsToExp@@ -408,7 +409,19 @@ -- -- @since 0.0.10 makeRelativeToProject :: FilePath -> Q FilePath-makeRelativeToProject rel = do+makeRelativeToProject = makeRelativeToLocationPredicate $ (==) ".cabal" . takeExtension++-- | Take a predicate to infer the project root and a relative file path, the given file path is then attached to the inferred project root+--+-- This function looks at the source location of the Haskell file calling it,+-- finds the first parent directory with a file matching the given predicate, and uses that as the+-- root directory for fixing the relative path.+--+-- @$(makeRelativeToLocationPredicate ((==) ".cabal" . takeExtension) "data/foo.txt" >>= embedFile)@+--+-- @since 0.0.15.0+makeRelativeToLocationPredicate :: (FilePath -> Bool) -> FilePath -> Q FilePath+makeRelativeToLocationPredicate isTargetFile rel = do     loc <- qLocation     runIO $ do         srcFP <- canonicalizePath $ loc_filename loc@@ -423,8 +436,6 @@             then return Nothing             else do                 contents <- getDirectoryContents dir-                if any isCabalFile contents+                if any isTargetFile contents                     then return (Just dir)                     else findProjectDir dir--    isCabalFile fp = takeExtension fp == ".cabal"
file-embed.cabal view
@@ -1,6 +1,6 @@ name:            file-embed-version:         0.0.14.0-license:         BSD3+version:         0.0.15.0+license:         BSD2 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com> maintainer:      Michael Snoyman <michael@snoyman.com>