[commit: packages/filepath] master: Bug fix: normalize "\\" == "\\" (9cacf87)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:34:28 UTC 2015
Repository : ssh://git@git.haskell.org/filepath
On branch : master
Link : http://git.haskell.org/packages/filepath.git/commitdiff/9cacf87d541fb8e92655228b21de926b96139bdd
>---------------------------------------------------------------
commit 9cacf87d541fb8e92655228b21de926b96139bdd
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Sat Oct 25 23:38:17 2014 +0200
Bug fix: normalize "\\" == "\\"
>---------------------------------------------------------------
9cacf87d541fb8e92655228b21de926b96139bdd
System/FilePath/Internal.hs | 3 ++-
changelog.md | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs
index f85e635..3abebe9 100644
--- a/System/FilePath/Internal.hs
+++ b/System/FilePath/Internal.hs
@@ -750,6 +750,7 @@ makeRelative root path
-- > Windows: normalise "c:\\" == "C:\\"
-- > Windows: normalise "\\\\server\\test" == "\\\\server\\test"
-- > Windows: normalise "c:/file" == "C:\\file"
+-- > Windows: normalise "\\" == "\\"
-- > normalise "." == "."
-- > Posix: normalise "./" == "./"
-- > Posix: normalise "./." == "./"
@@ -757,7 +758,7 @@ makeRelative root path
-- > Posix: normalise "bob/fred/." == "bob/fred/"
normalise :: FilePath -> FilePath
normalise path = joinDrive' (normaliseDrive drv) (f pth)
- ++ [pathSeparator | isDirPath pth]
+ ++ [pathSeparator | isDirPath pth && length pth > 1]
where
(drv,pth) = splitDrive path
diff --git a/changelog.md b/changelog.md
index 13dad0e..81d832a 100644
--- a/changelog.md
+++ b/changelog.md
@@ -7,6 +7,9 @@
* Bug fix: on Windows, `dropTrailingPathSeparator "/"` now returns `"/"`
unchanged, instead of the normalised `"\\"`.
+ * Bug fix: on Windows, `normalise "\\"` now retuns `"\\"` unchanged,
+ instead of `"\\\\"`.
+
## 1.3.0.2 *Mar 2014*
* Bundled with GHC 7.8.1
More information about the ghc-commits
mailing list