From 9b305229bef11aed9e9494210f33b483708bfb90 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Thu, 7 Mar 2013 18:48:11 +0100 Subject: Use resourceFilePath for copyFileCompiler Closes #117 --- src/Hakyll/Core/File.hs | 19 ++++++++----------- src/Hakyll/Core/Provider.hs | 1 + 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src/Hakyll/Core') 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 -- cgit v1.2.3