Skip to content

Commit 7c9b722

Browse files
committed
Make clear that equalFilePath does not expand ".."
Fixes #87
1 parent 01fda37 commit 7c9b722

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

System/FilePath/Internal.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,12 @@ joinPath = foldr combine ""
768768
-- first this has a much better chance of working.
769769
-- Note that this doesn't follow symlinks or DOSNAM~1s.
770770
--
771+
-- Similar to 'normalise', this does not expand @".."@, because of symlinks.
772+
--
771773
-- > x == y ==> equalFilePath x y
772774
-- > normalise x == normalise y ==> equalFilePath x y
773775
-- > equalFilePath "foo" "foo/"
776+
-- > not (equalFilePath "/a/../c" "/c")
774777
-- > not (equalFilePath "foo" "/foo")
775778
-- > Posix: not (equalFilePath "foo" "FOO")
776779
-- > Windows: equalFilePath "foo" "FOO"

System/FilePath/Posix.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,12 @@ joinPath = foldr combine ""
768768
-- first this has a much better chance of working.
769769
-- Note that this doesn't follow symlinks or DOSNAM~1s.
770770
--
771+
-- Similar to 'normalise', this does not expand @".."@, because of symlinks.
772+
--
771773
-- > x == y ==> equalFilePath x y
772774
-- > normalise x == normalise y ==> equalFilePath x y
773775
-- > equalFilePath "foo" "foo/"
776+
-- > not (equalFilePath "/a/../c" "/c")
774777
-- > not (equalFilePath "foo" "/foo")
775778
-- > Posix: not (equalFilePath "foo" "FOO")
776779
-- > Windows: equalFilePath "foo" "FOO"

System/FilePath/Windows.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,12 @@ joinPath = foldr combine ""
768768
-- first this has a much better chance of working.
769769
-- Note that this doesn't follow symlinks or DOSNAM~1s.
770770
--
771+
-- Similar to 'normalise', this does not expand @".."@, because of symlinks.
772+
--
771773
-- > x == y ==> equalFilePath x y
772774
-- > normalise x == normalise y ==> equalFilePath x y
773775
-- > equalFilePath "foo" "foo/"
776+
-- > not (equalFilePath "/a/../c" "/c")
774777
-- > not (equalFilePath "foo" "/foo")
775778
-- > Posix: not (equalFilePath "foo" "FOO")
776779
-- > Windows: equalFilePath "foo" "FOO"

tests/TestGen.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ tests =
359359
,("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)
360360
,("P.equalFilePath \"foo\" \"foo/\"", property $ P.equalFilePath "foo" "foo/")
361361
,("W.equalFilePath \"foo\" \"foo/\"", property $ W.equalFilePath "foo" "foo/")
362+
,("not (P.equalFilePath \"/a/../c\" \"/c\")", property $ not (P.equalFilePath "/a/../c" "/c"))
363+
,("not (W.equalFilePath \"/a/../c\" \"/c\")", property $ not (W.equalFilePath "/a/../c" "/c"))
362364
,("not (P.equalFilePath \"foo\" \"/foo\")", property $ not (P.equalFilePath "foo" "/foo"))
363365
,("not (W.equalFilePath \"foo\" \"/foo\")", property $ not (W.equalFilePath "foo" "/foo"))
364366
,("not (P.equalFilePath \"foo\" \"FOO\")", property $ not (P.equalFilePath "foo" "FOO"))

0 commit comments

Comments
 (0)