From 85b82429e5a7726e4494ac80d941cc130ac68a38 Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Mon, 24 May 2021 19:03:18 -0400 Subject: [PATCH 1/3] Allow time 1.11 --- unix-compat.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix-compat.cabal b/unix-compat.cabal index 7c59b9f..51ce974 100644 --- a/unix-compat.cabal +++ b/unix-compat.cabal @@ -57,7 +57,7 @@ Library else build-depends: directory == 1.1.* else - build-depends: time >= 1.0 && < 1.10 + build-depends: time >= 1.0 && < 1.12 build-depends: directory >= 1.2 && < 1.4 other-modules: From d2020b4ad0443fd59d46bc44dcf2c19e539f37e0 Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Mon, 24 May 2021 19:38:18 -0400 Subject: [PATCH 2/3] Support Win32 2.12 --- src/System/PosixCompat/Files.hsc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/System/PosixCompat/Files.hsc b/src/System/PosixCompat/Files.hsc index 0205a21..95bf23a 100644 --- a/src/System/PosixCompat/Files.hsc +++ b/src/System/PosixCompat/Files.hsc @@ -139,6 +139,7 @@ import System.PosixCompat.Types import System.Win32.File hiding (getFileType) import System.Win32.HardLink (createHardLink) import System.Win32.Time (FILETIME(..), getFileTime, setFileTime) +import System.Win32.Types (HANDLE) import System.PosixCompat.Internal.Time ( getClockTime, clockTimeToEpochTime @@ -452,7 +453,7 @@ setFileTimes :: FilePath -> EpochTime -> EpochTime -> IO () setFileTimes file atime mtime = bracket openFileHandle closeHandle $ \handle -> do (creationTime, _, _) <- getFileTime handle - setFileTime + setFileTimeCompat handle creationTime (epochTimeToFileTime atime) @@ -472,6 +473,14 @@ setFileTimes file atime mtime = ll :: Int64 ll = fromIntegral t * 10000000 + 116444736000000000 +setFileTimeCompat :: HANDLE -> FILETIME -> FILETIME -> FILETIME -> IO () +setFileTimeCompat h crt acc wrt = +#if MIN_VERSION_Win32(2, 12, 0) + setFileTime h (Just crt) (Just acc) (Just wrt) +#else + setFileTime h crt acc wrt +#endif + touchFile :: FilePath -> IO () touchFile name = do t <- liftM clockTimeToEpochTime getClockTime From 154c3a63f154cb49c51d5f9d13488e8119631d8a Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Sat, 10 Jul 2021 14:51:45 -0400 Subject: [PATCH 3/3] Allow time 1.12 --- unix-compat.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix-compat.cabal b/unix-compat.cabal index 51ce974..941ed37 100644 --- a/unix-compat.cabal +++ b/unix-compat.cabal @@ -57,7 +57,7 @@ Library else build-depends: directory == 1.1.* else - build-depends: time >= 1.0 && < 1.12 + build-depends: time >= 1.0 && < 1.13 build-depends: directory >= 1.2 && < 1.4 other-modules: