[commit: packages/filepath] master: Cleanup: explicit is better than implicit (05f4f71)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 11:36:42 UTC 2015


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

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

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

commit 05f4f71ba731a94081f4904ac15b6d96ca6e1d8a
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Fri Oct 31 23:50:04 2014 +0100

    Cleanup: explicit is better than implicit


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

05f4f71ba731a94081f4904ac15b6d96ca6e1d8a
 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 8f2c51b..bd02ddd 100644
--- a/System/FilePath/Internal.hs
+++ b/System/FilePath/Internal.hs
@@ -807,7 +807,7 @@ isValid _ | isPosix = True
 isValid path =
         not (any (`elem` badCharacters) x2) &&
         not (any f $ splitDirectories x2) &&
-        not (length x1 >= 2 && all isPathSeparator x1) &&
+        not (isJust (readDriveShare x1) && all isPathSeparator x1) &&
         not (isJust (readDriveUNC x1) && not (hasTrailingPathSeparator x1))
     where
         (x1,x2) = splitDrive path
@@ -832,7 +832,7 @@ makeValid :: FilePath -> FilePath
 makeValid "" = "_"
 makeValid path
         | isPosix = path
-        | length drv >= 2 && all isPathSeparator drv = take 2 drv ++ "drive"
+        | isJust (readDriveShare drv) && all isPathSeparator drv = take 2 drv ++ "drive"
         | isJust (readDriveUNC drv) && not (hasTrailingPathSeparator drv) =
             makeValid (drv ++ [pathSeparator] ++ pth)
         | otherwise = joinDrive drv $ validElements $ validChars pth



More information about the ghc-commits mailing list