[commit: packages/filepath] master: Refactor: use hasTrailingPathSeparator in joinDrive and combineAlways (facd0db)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 11:35:08 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/packages/filepath.git/commitdiff/facd0dbfc465ab2f727eb1add7d9803ba462b56f

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

commit facd0dbfc465ab2f727eb1add7d9803ba462b56f
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Fri Oct 24 21:11:09 2014 +0200

    Refactor: use hasTrailingPathSeparator in joinDrive and combineAlways


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

facd0dbfc465ab2f727eb1add7d9803ba462b56f
 System/FilePath/Internal.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs
index 7dec998..e48d01b 100644
--- a/System/FilePath/Internal.hs
+++ b/System/FilePath/Internal.hs
@@ -386,7 +386,7 @@ joinDrive :: FilePath -> FilePath -> FilePath
 joinDrive a b | isPosix = a ++ b
               | null a = b
               | null b = a
-              | isPathSeparator (last a) = a ++ b
+              | hasTrailingPathSeparator a = a ++ b
               | otherwise = case a of
                                 [a1,':'] | isLetter a1 -> a ++ b
                                 _ -> a ++ [pathSeparator] ++ b
@@ -602,7 +602,7 @@ combine a b | hasLeadingPathSeparator b || hasDrive b = b
 combineAlways :: FilePath -> FilePath -> FilePath
 combineAlways a b | null a = b
                   | null b = a
-                  | isPathSeparator (last a) = a ++ b
+                  | hasTrailingPathSeparator a = a ++ b
                   | isDrive a = joinDrive a b
                   | otherwise = a ++ [pathSeparator] ++ b
 



More information about the ghc-commits mailing list