[commit: packages/directory] master: Set the filename in IO errors from the file time functions (5f431e0)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 09:50:57 UTC 2015


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5f431e0905acb7e5d1c02beea0eefad94829645e/directory

>---------------------------------------------------------------

commit 5f431e0905acb7e5d1c02beea0eefad94829645e
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Sat May 30 23:58:10 2015 -0400

    Set the filename in IO errors from the file time functions


>---------------------------------------------------------------

5f431e0905acb7e5d1c02beea0eefad94829645e
 System/Directory.hs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index 8bd06c2..99b36a4 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -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
@@ -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



More information about the ghc-commits mailing list