[commit: packages/filepath] master: Cleanup: rename file to dir in takeDirectory (53db747)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:34:18 UTC 2015
Repository : ssh://git@git.haskell.org/filepath
On branch : master
Link : http://git.haskell.org/packages/filepath.git/commitdiff/53db7473fb3338fe8e47d58320234bd82c52466b
>---------------------------------------------------------------
commit 53db7473fb3338fe8e47d58320234bd82c52466b
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Sun Sep 14 20:49:52 2014 +0200
Cleanup: rename file to dir in takeDirectory
>---------------------------------------------------------------
53db7473fb3338fe8e47d58320234bd82c52466b
System/FilePath/Internal.hs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs
index f85e635..5ea2be5 100644
--- a/System/FilePath/Internal.hs
+++ b/System/FilePath/Internal.hs
@@ -552,10 +552,10 @@ dropTrailingPathSeparator x =
-- > Windows: takeDirectory "foo\\bar\\\\" == "foo\\bar"
-- > Windows: takeDirectory "C:\\" == "C:\\"
takeDirectory :: FilePath -> FilePath
-takeDirectory x = if isDrive file || (null res && not (null file)) then file else res
+takeDirectory x = if isDrive dir || (null res && not (null dir)) then dir else res
where
- res = reverse $ dropWhile isPathSeparator $ reverse file
- file = dropFileName x
+ res = reverse $ dropWhile isPathSeparator $ reverse dir
+ dir = dropFileName x
_ = isPrefixOf x -- warning suppression
-- | Set the directory, keeping the filename the same.
More information about the ghc-commits
mailing list