Skip to content

Commit

Permalink
Set the filename in IO errors from the file time functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rufflewind committed Jun 4, 2015
1 parent 41cd458 commit 5f431e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions System/Directory.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,8 @@ getModificationTime = modifyIOError (`ioeSetLocation` "getModificationTime") .
getFileTime True

getFileTime :: Bool -> FilePath -> IO UTCTime
getFileTime isMtime path = posixSecondsToUTCTime <$> getTime
getFileTime isMtime path = modifyIOError (`ioeSetFileName` path) $
posixSecondsToUTCTime <$> getTime
where
path' = normalise path -- handle empty paths
#ifdef mingw32_HOST_OS
Expand Down Expand Up @@ -1202,7 +1203,8 @@ getFileTime isMtime path = posixSecondsToUTCTime <$> getTime
--
setModificationTime :: FilePath -> UTCTime -> IO ()
setModificationTime path mtime =
modifyIOError (`ioeSetLocation` "setModificationTime") setTime
modifyIOError ((`ioeSetLocation` "setModificationTime") .
(`ioeSetFileName` path)) setTime
where
path' = normalise path -- handle empty paths
mtime' = utcTimeToPOSIXSeconds mtime
Expand Down

0 comments on commit 5f431e0

Please sign in to comment.