[commit: packages/filepath] master: Bug fix: normalise "//server/test" == "\\\\server\\test" (645d297)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 11:34:30 UTC 2015


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

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

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

commit 645d2972ec3929d1e22975879082e3afcae516c8
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Sun Oct 26 21:19:39 2014 +0100

    Bug fix: normalise "//server/test" == "\\\\server\\test"
    
    When drive represents a network share, slashes were not being normalised
    properly.


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

645d2972ec3929d1e22975879082e3afcae516c8
 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 3abebe9..7256991 100644
--- a/System/FilePath/Internal.hs
+++ b/System/FilePath/Internal.hs
@@ -749,6 +749,7 @@ makeRelative root path
 -- > Windows: normalise "c:\\file/bob\\" == "C:\\file\\bob\\"
 -- > Windows: normalise "c:\\" == "C:\\"
 -- > Windows: normalise "\\\\server\\test" == "\\\\server\\test"
+-- > Windows: normalise "//server/test" == "\\\\server\\test"
 -- > Windows: normalise "c:/file" == "C:\\file"
 -- > Windows: normalise "\\" == "\\"
 -- >          normalise "." == "."
@@ -783,7 +784,7 @@ normaliseDrive :: FilePath -> FilePath
 normaliseDrive drive | isPosix = drive
 normaliseDrive drive = if isJust $ readDriveLetter x2
                        then map toUpper x2
-                       else drive
+                       else x2
     where
         x2 = map repSlash drive
 
diff --git a/changelog.md b/changelog.md
index 81d832a..3e87a9c 100644
--- a/changelog.md
+++ b/changelog.md
@@ -10,6 +10,9 @@
   * Bug fix: on Windows, `normalise "\\"` now retuns `"\\"` unchanged,
     instead of `"\\\\"`.
 
+  * Bug fix: on Windows, `normalise "//server/test"` now retuns
+    `"\\\\server\\test"`, instead of `"//server/test"` unchanged.
+
 ## 1.3.0.2  *Mar 2014*
 
   * Bundled with GHC 7.8.1



More information about the ghc-commits mailing list