summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Core/File.hs19
-rw-r--r--src/Hakyll/Core/Provider.hs1
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