file-embed-0.0.4.1: Use Template Haskell to embed file contents directly.

Safe HaskellNone

Data.FileEmbed

Contents

Synopsis

Embed at compile time

embedFile :: FilePath -> Q ExpSource

Embed a single file in your source code.

 import qualified Data.ByteString

 myFile :: Data.ByteString.ByteString
 myFile = $(embedFile "dirName/fileName")

embedDir :: FilePath -> Q ExpSource

Embed a directory recusrively in your source code.

 import qualified Data.ByteString

 myDir :: [(FilePath, Data.ByteString.ByteString)]
 myDir = $(embedDir "dirName")

getDir :: FilePath -> IO [(FilePath, ByteString)]Source

Get a directory tree in the IO monad.

This is the workhorse of embedDir

Inject into an executable

injectSource

Arguments

:: ByteString

bs to inject

-> ByteString

original BS containing dummy

-> Maybe ByteString

new BS, or Nothing if there is insufficient dummy space

injectFileSource

Arguments

:: ByteString 
-> FilePath

template file

-> FilePath

output file

-> IO ()