Commit 03dfb79c authored by thomie's avatar thomie
Browse files

Bug fix: on Windows, makeRelative "/" "//" == "//"

parent 1903af3a
......@@ -693,6 +693,7 @@ equalFilePath a b = f a == f b
-- > Windows: makeRelative "C:\\Home" "D:\\Home\\Bob" == "D:\\Home\\Bob"
-- > Windows: makeRelative "C:\\Home" "C:Home\\Bob" == "C:Home\\Bob"
-- > Windows: makeRelative "/Home" "/home/bob" == "bob"
-- > Windows: makeRelative "/" "//" == "//"
-- > Posix: makeRelative "/Home" "/home/bob" == "/home/bob"
-- > Posix: makeRelative "/home/" "/home/bob/foo/bar" == "bob/foo/bar"
-- > Posix: makeRelative "/fred" "bob" == "bob"
......@@ -714,10 +715,10 @@ makeRelative root path
where (a,b) = break isPathSeparator $ dropWhile isPathSeparator x
-- on windows, need to drop '/' which is kind of absolute, but not a drive
dropAbs (x:xs) | isPathSeparator x = xs
dropAbs x | hasLeadingPathSeparator x && not (hasDrive x) = tail x
dropAbs x = dropDrive x
takeAbs (x:_) | isPathSeparator x = [pathSeparator]
takeAbs x | hasLeadingPathSeparator x && not (hasDrive x) = [pathSeparator]
takeAbs x = map (\y -> if isPathSeparator y then pathSeparator else toLower y) $ takeDrive x
-- | Normalise a file
......
......@@ -21,6 +21,9 @@
* Bug fix: on Windows, `normalise "//server/test"` now retuns
`"\\\\server\\test"`, instead of `"//server/test"` unchanged.
* Bug fix: on Windows, `makeRelative "/" "//"` now returns `"//"`, instead
of `""`.
## 1.3.0.2 *Mar 2014*
* Bundled with GHC 7.8.1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment