diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-04-03 12:07:03 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-04-03 12:07:03 +0200 |
commit | c40cf286afacd130c1ddd28abacb3c484895076b (patch) | |
tree | 83b3eaad146752b3ee7457872964c0e6bef622e1 /src/Hakyll | |
parent | 5e4adaecb232231d87a6bb4dd0b041daf86a4cdb (diff) | |
download | hakyll-c40cf286afacd130c1ddd28abacb3c484895076b.tar.gz |
Add `getResourceFilePath`
See #130
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index b711719..c0a217f 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -10,7 +10,7 @@ module Hakyll.Core.Compiler , getResourceBody , getResourceString , getResourceLBS - , getResourceWith + , getResourceFilePath , Internal.Snapshot , saveSnapshot @@ -99,6 +99,15 @@ getResourceLBS = getResourceWith resourceLBS -------------------------------------------------------------------------------- +-- | Get the file path of the resource we are compiling +getResourceFilePath :: Compiler FilePath +getResourceFilePath = do + provider <- compilerProvider <$> compilerAsk + id' <- compilerUnderlying <$> compilerAsk + return $ resourceFilePath provider id' + + +-------------------------------------------------------------------------------- -- | Overloadable function for 'getResourceString' and 'getResourceLBS' getResourceWith :: (Provider -> Identifier -> IO a) -> Compiler (Item a) getResourceWith reader = do |