diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-19 15:52:51 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-19 15:52:51 +0100 |
commit | b1f70c339e031c1f6abf04ff63566f2cb9757a07 (patch) | |
tree | aa47c4720f03d91537a26cd88981da41606c3fad /src/Hakyll/Core/Provider | |
parent | 802742cdbed1bb0afa022e072621e621d21158f6 (diff) | |
download | hakyll-b1f70c339e031c1f6abf04ff63566f2cb9757a07.tar.gz |
Support old directory versions...
Diffstat (limited to 'src/Hakyll/Core/Provider')
-rw-r--r-- | src/Hakyll/Core/Provider/Modified.hs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/Hakyll/Core/Provider/Modified.hs b/src/Hakyll/Core/Provider/Modified.hs index 08bb66a..8fad96a 100644 --- a/src/Hakyll/Core/Provider/Modified.hs +++ b/src/Hakyll/Core/Provider/Modified.hs @@ -1,4 +1,5 @@ -------------------------------------------------------------------------------- +{-# LANGUAGE CPP #-} module Hakyll.Core.Provider.Modified ( resourceModified , resourceModificationTime @@ -15,7 +16,15 @@ import Data.IORef import qualified Data.Map as M import Data.Time (UTCTime) import System.Directory (getModificationTime) -import System.FilePath ((</>)) + + +-------------------------------------------------------------------------------- +#if !MIN_VERSION_directory(1,2,0) +import Data.Time (readTime) +import System.Locale (defaultTimeLocale) +import System.Time (formatCalendarTime, + toCalendarTime) +#endif -------------------------------------------------------------------------------- @@ -82,5 +91,11 @@ fileDigest = fmap MD5.hashlazy . BL.readFile -------------------------------------------------------------------------------- resourceModificationTime :: Provider -> Identifier -> IO UTCTime -resourceModificationTime p i = - getModificationTime $ providerDirectory p </> toFilePath i +resourceModificationTime p i = do +#if MIN_VERSION_directory(1,2,0) + getModificationTime $ resourceFilePath p i +#else + ct <- toCalendarTime =<< getModificationTime (resourceFilePath p i) + let str = formatCalendarTime defaultTimeLocale "%s" ct + return $ readTime defaultTimeLocale "%s" str +#endif |