diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs index 5a8f14f6..8a1e1391 100644 --- a/System/FilePath/Internal.hs +++ b/System/FilePath/Internal.hs @@ -768,9 +768,12 @@ joinPath = foldr combine "" -- first this has a much better chance of working. -- Note that this doesn't follow symlinks or DOSNAM~1s. -- +-- Similar to 'normalise', this does not expand @".."@, because of symlinks. +-- -- > x == y ==> equalFilePath x y -- > normalise x == normalise y ==> equalFilePath x y -- > equalFilePath "foo" "foo/" +-- > not (equalFilePath "/a/../c" "/c") -- > not (equalFilePath "foo" "/foo") -- > Posix: not (equalFilePath "foo" "FOO") -- > Windows: equalFilePath "foo" "FOO" diff --git a/System/FilePath/Posix.hs b/System/FilePath/Posix.hs index 743d20d5..b7e61197 100644 --- a/System/FilePath/Posix.hs +++ b/System/FilePath/Posix.hs @@ -768,9 +768,12 @@ joinPath = foldr combine "" -- first this has a much better chance of working. -- Note that this doesn't follow symlinks or DOSNAM~1s. -- +-- Similar to 'normalise', this does not expand @".."@, because of symlinks. +-- -- > x == y ==> equalFilePath x y -- > normalise x == normalise y ==> equalFilePath x y -- > equalFilePath "foo" "foo/" +-- > not (equalFilePath "/a/../c" "/c") -- > not (equalFilePath "foo" "/foo") -- > Posix: not (equalFilePath "foo" "FOO") -- > Windows: equalFilePath "foo" "FOO" diff --git a/System/FilePath/Windows.hs b/System/FilePath/Windows.hs index 6099975f..15877020 100644 --- a/System/FilePath/Windows.hs +++ b/System/FilePath/Windows.hs @@ -768,9 +768,12 @@ joinPath = foldr combine "" -- first this has a much better chance of working. -- Note that this doesn't follow symlinks or DOSNAM~1s. -- +-- Similar to 'normalise', this does not expand @".."@, because of symlinks. +-- -- > x == y ==> equalFilePath x y -- > normalise x == normalise y ==> equalFilePath x y -- > equalFilePath "foo" "foo/" +-- > not (equalFilePath "/a/../c" "/c") -- > not (equalFilePath "foo" "/foo") -- > Posix: not (equalFilePath "foo" "FOO") -- > Windows: equalFilePath "foo" "FOO" diff --git a/tests/TestGen.hs b/tests/TestGen.hs index 37046dc9..6364537d 100755 --- a/tests/TestGen.hs +++ b/tests/TestGen.hs @@ -359,6 +359,8 @@ tests = ,("W.normalise x == W.normalise y ==> W.equalFilePath x y", property $ \(QFilePath x) (QFilePath y) -> W.normalise x == W.normalise y ==> W.equalFilePath x y) ,("P.equalFilePath \"foo\" \"foo/\"", property $ P.equalFilePath "foo" "foo/") ,("W.equalFilePath \"foo\" \"foo/\"", property $ W.equalFilePath "foo" "foo/") + ,("not (P.equalFilePath \"/a/../c\" \"/c\")", property $ not (P.equalFilePath "/a/../c" "/c")) + ,("not (W.equalFilePath \"/a/../c\" \"/c\")", property $ not (W.equalFilePath "/a/../c" "/c")) ,("not (P.equalFilePath \"foo\" \"/foo\")", property $ not (P.equalFilePath "foo" "/foo")) ,("not (W.equalFilePath \"foo\" \"/foo\")", property $ not (W.equalFilePath "foo" "/foo")) ,("not (P.equalFilePath \"foo\" \"FOO\")", property $ not (P.equalFilePath "foo" "FOO"))