Commit ee255344 authored by thomie's avatar thomie
Browse files

Bug fix: normalise "//home" == "/home" (Posix)

parent f7869ab0
......@@ -743,6 +743,7 @@ makeRelative root path
-- > Posix: normalise "/./" == "/"
-- > Posix: normalise "/" == "/"
-- > Posix: normalise "bob/fred/." == "bob/fred/"
-- > Posix: normalise "//home" == "/home"
normalise :: FilePath -> FilePath
normalise path = result ++ [pathSeparator | addPathSeparator]
where
......@@ -767,7 +768,8 @@ normalise path = result ++ [pathSeparator | addPathSeparator]
dropDots = filter ("." /=)
normaliseDrive :: FilePath -> FilePath
normaliseDrive drive | isPosix = drive
normaliseDrive "" = ""
normaliseDrive _ | isPosix = [pathSeparator]
normaliseDrive drive = if isJust $ readDriveLetter x2
then map toUpper x2
else x2
......
......@@ -7,6 +7,9 @@
* Semantic change: `joinDrive "/foo" "bar"` now returns `"/foo/bar"`,
instead of `"/foobar"`.
* Bug fix, on Posix systems, `normalise "//home"` now returns `"/home"`,
instead of `"//home"`.
* Bug fix, `normalise "/./"` now returns "/" on Posix and "\\" on Windows,
instead of "//" and "\\\\".
......
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