[commit: packages/directory] master: Correct the trailing slash behavior of makeAbsolute on empty string (5da8cbc)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 09:51:05 UTC 2015


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

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

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

commit 5da8cbcf978a8f63b3fc58c7a8825a3469bc2a17
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Sun May 31 04:15:48 2015 -0400

    Correct the trailing slash behavior of makeAbsolute on empty string
    
    Rationale: behavior of makeAbsolute on "." and "" should be identical


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

5da8cbcf978a8f63b3fc58c7a8825a3469bc2a17
 System/Directory.hs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index 4707f38..24a84d9 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -839,7 +839,8 @@ foreign import ccall unsafe "realpath"
 makeAbsolute :: FilePath -> IO FilePath
 makeAbsolute = (normalise <$>) . absolutize
   where absolutize path -- avoid the call to `getCurrentDirectory` if we can
-          | isRelative path = (</> path) <$> getCurrentDirectory
+          | isRelative path = (</> path) . addTrailingPathSeparator <$>
+                              getCurrentDirectory
           | otherwise       = return path
 
 -- | 'makeRelative' the current directory.



More information about the ghc-commits mailing list