diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-03-07 18:48:11 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-03-07 18:48:11 +0100 |
commit | 9b305229bef11aed9e9494210f33b483708bfb90 (patch) | |
tree | 96b204fea8dd8aa5f411ac18a769dd3405a88f5a /src | |
parent | ca49489110440d43823d3ee4345a0cd580bcbbc7 (diff) | |
download | hakyll-9b305229bef11aed9e9494210f33b483708bfb90.tar.gz |
Use resourceFilePath for copyFileCompiler
Closes #117
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll/Core/File.hs | 19 | ||||
-rw-r--r-- | src/Hakyll/Core/Provider.hs | 1 |
2 files changed, 9 insertions, 11 deletions
diff --git a/src/Hakyll/Core/File.hs b/src/Hakyll/Core/File.hs index a7b4a35..26724e1 100644 --- a/src/Hakyll/Core/File.hs +++ b/src/Hakyll/Core/File.hs @@ -24,8 +24,8 @@ import System.Random (randomIO) import Hakyll.Core.Compiler import Hakyll.Core.Compiler.Internal import Hakyll.Core.Configuration -import Hakyll.Core.Identifier import Hakyll.Core.Item +import Hakyll.Core.Provider import qualified Hakyll.Core.Store as Store import Hakyll.Core.Util.File import Hakyll.Core.Writable @@ -33,24 +33,21 @@ import Hakyll.Core.Writable -------------------------------------------------------------------------------- -- | This will copy any file directly by using a system call -data CopyFile = CopyFile - deriving (Show, Eq, Ord, Typeable) - - --------------------------------------------------------------------------------- -instance Binary CopyFile where - put CopyFile = return () - get = return CopyFile +newtype CopyFile = CopyFile FilePath + deriving (Binary, Eq, Ord, Show, Typeable) -------------------------------------------------------------------------------- instance Writable CopyFile where - write dst item = copyFile (toFilePath $ itemIdentifier item) dst + write dst (Item _ (CopyFile src)) = copyFile src dst -------------------------------------------------------------------------------- copyFileCompiler :: Compiler (Item CopyFile) -copyFileCompiler = makeItem CopyFile +copyFileCompiler = do + identifier <- getUnderlying + provider <- compilerProvider <$> compilerAsk + makeItem $ CopyFile $ resourceFilePath provider identifier -------------------------------------------------------------------------------- diff --git a/src/Hakyll/Core/Provider.hs b/src/Hakyll/Core/Provider.hs index 00b694d..400f044 100644 --- a/src/Hakyll/Core/Provider.hs +++ b/src/Hakyll/Core/Provider.hs @@ -9,6 +9,7 @@ module Hakyll.Core.Provider -- * Querying resource properties , Internal.resourceList , Internal.resourceExists + , Internal.resourceFilePath , Internal.resourceModified , Internal.resourceModificationTime |