From c40cf286afacd130c1ddd28abacb3c484895076b Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 3 Apr 2013 12:07:03 +0200 Subject: Add `getResourceFilePath` See #130 --- src/Hakyll/Core/Compiler.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/Hakyll') 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 @@ -98,6 +98,15 @@ getResourceLBS :: Compiler (Item ByteString) 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) -- cgit v1.2.3