Skip to content

Commit

Permalink
Make clear that equalFilePath does not expand ".."
Browse files Browse the repository at this point in the history
Fixes #87
  • Loading branch information
hasufell committed Dec 3, 2021
1 parent 01fda37 commit 7c9b722
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions System/FilePath/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions System/FilePath/Posix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions System/FilePath/Windows.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions tests/TestGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 7c9b722

Please sign in to comment.