diff options
author | frederik-h <frederik-h@users.noreply.github.com> | 2017-02-11 18:18:23 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2017-02-11 12:18:23 -0500 |
commit | ba272c9ba9cddb306cd30c976fb95a8ae7a06b85 (patch) | |
tree | 6d440528ba0f714d12e6688b613704822e6af495 | |
parent | fbd2c6d6829d9bd177b4d0329f539cdf040ba59d (diff) | |
download | hakyll-ba272c9ba9cddb306cd30c976fb95a8ae7a06b85.tar.gz |
Preserve file metadata in copyFileCompiler
-rw-r--r-- | src/Hakyll/Core/File.hs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Hakyll/Core/File.hs b/src/Hakyll/Core/File.hs index 1c3a9df..49af659 100644 --- a/src/Hakyll/Core/File.hs +++ b/src/Hakyll/Core/File.hs @@ -1,5 +1,6 @@ -------------------------------------------------------------------------------- -- | Exports simple compilers to just copy files +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Hakyll.Core.File @@ -13,7 +14,12 @@ module Hakyll.Core.File -------------------------------------------------------------------------------- import Data.Binary (Binary (..)) import Data.Typeable (Typeable) -import System.Directory (copyFile, doesFileExist, +#if MIN_VERSION_directory(1,2,6) +import System.Directory (copyFileWithMetadata) +#else +import System.Directory (copyFile) +#endif +import System.Directory (doesFileExist, renameFile) import System.FilePath ((</>)) import System.Random (randomIO) @@ -38,9 +44,11 @@ newtype CopyFile = CopyFile FilePath -------------------------------------------------------------------------------- instance Writable CopyFile where +#if MIN_VERSION_directory(1,2,6) + write dst (Item _ (CopyFile src)) = copyFileWithMetadata src dst +#else write dst (Item _ (CopyFile src)) = copyFile src dst - - +#endif -------------------------------------------------------------------------------- copyFileCompiler :: Compiler (Item CopyFile) copyFileCompiler = do |