Skip to content

Commit

Permalink
v0.3.16.6 fix #31 Build failure on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Nov 30, 2024
1 parent 4986bc7 commit 873a1cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
7 changes: 7 additions & 0 deletions system-fileio/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog for system-fileio

## 0.3.16.6

* Fix building on Windows ([issue #31](https://github.com/fpco/haskell-filesystem/issues/31), regression in 0.3.16.5).
* Tested with:
- Cabal and GHC 8.0 - 9.12.0 on Linux
- Stack and GHC 9.8.2 on Linux, macOS and Windows.

## 0.3.16.5

* Fix building of the testsuite with `unix-2.8`.
Expand Down
25 changes: 11 additions & 14 deletions system-fileio/lib/Filesystem.hs
Original file line number Diff line number Diff line change
Expand Up @@ -710,20 +710,17 @@ getModified path = do
info <- withHANDLE path Win32.getFileInformationByHandle
let ftime = Win32.bhfiLastWriteTime info
stime <- Win32.fileTimeToSystemTime ftime

let date = fromGregorian
(fromIntegral (Win32.wYear stime))
(fromIntegral (Win32.wMonth stime))
(fromIntegral (Win32.wDay stime))

let seconds = secondsToDiffTime $
(toInteger (Win32.wHour stime) * 3600) +
(toInteger (Win32.wMinute stime) * 60) +
(toInteger (Win32.wSecond stime))

let msecs = picosecondsToDiffTime $
(toInteger (Win32.wMilliseconds stime) * 1000000000)

let
date = fromGregorian
(fromIntegral (Win32.wYear stime))
(fromIntegral (Win32.wMonth stime))
(fromIntegral (Win32.wDay stime))
seconds = secondsToDiffTime $
(toInteger (Win32.wHour stime) * 3600) +
(toInteger (Win32.wMinute stime) * 60) +
(toInteger (Win32.wSecond stime))
msecs = picosecondsToDiffTime $
(toInteger (Win32.wMilliseconds stime) * 1000000000)
return (UTCTime date (seconds + msecs))
#else
stat <- posixStat "getModified" path
Expand Down

0 comments on commit 873a1cd

Please sign in to comment.