Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed compiling on Windows #14

Merged
merged 3 commits into from
Aug 7, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/System/IO/WindowsCompat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ import System.IO.StatCompat
import System.Posix.Consts
import System.Time.Utils
import System.Directory
import Data.Time
import Data.Time.Clock.POSIX

-- these types aren't defined here

Expand Down Expand Up @@ -112,6 +114,9 @@ otherModes = 0o00007
accessModes :: FileMode
accessModes = ownerModes .|. groupModes .|. otherModes

utcTimeToSeconds :: Num a => UTCTime -> a
utcTimeToSeconds = fromInteger . floor . utcTimeToPOSIXSeconds

----------- stat
type FileStatus = FileStatusCompat
getFileStatus :: FilePath -> IO FileStatus
Expand All @@ -120,7 +125,11 @@ getFileStatus fp =
isdir <- doesDirectoryExist fp
perms <- getPermissions fp
modct <- getModificationTime fp
#if MIN_VERSION_directory(1,2,0)
let epochtime = utcTimeToSeconds modct
#else
let epochtime = clockTimeToEpoch modct
#endif
return $ FileStatusCompat {deviceID = -1,
fileID = -1,
fileMode = if isfile then regularFileMode
Expand Down