File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based
55## [ Unreleased]
66
77Breaking changes:
8+ - ` relative ` now returns ` Effect FilePath ` , since Node resolves both arguments against the current working directory (#25 )
89
910New features:
1011
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export function resolve(from) {
1010}
1111
1212export function relative ( from ) {
13- return to => path . relative ( from , to ) ;
13+ return to => ( ) => path . relative ( from , to ) ;
1414}
1515
1616export function dirname ( p ) {
Original file line number Diff line number Diff line change @@ -17,8 +17,10 @@ foreign import concat :: Array FilePath -> FilePath
1717-- | Resolves `to` to an absolute path ([from...], to).
1818foreign import resolve :: Array FilePath -> FilePath -> Effect FilePath
1919
20- -- | Solve the relative path from `from` to `to`.
21- foreign import relative :: FilePath -> FilePath -> FilePath
20+ -- | Solve the relative path from `from` to `to`. Both paths are resolved
21+ -- | against the current working directory first, so the result depends on it
22+ -- | whenever either path is relative.
23+ foreign import relative :: FilePath -> FilePath -> Effect FilePath
2224
2325-- | Return the directory name of a path.
2426foreign import dirname :: FilePath -> FilePath
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ main :: Effect Unit
1010main = do
1111 assertEqual { actual: normalize " /foo/bar//baz/asdf/quux/.." , expected: normalize " /foo/bar/baz/asdf" }
1212 assertEqual { actual: concat [" /foo" , " bar" ], expected: normalize " /foo/bar" }
13- assertEqual { actual: relative " /data/orandea/test/aaa" " /data/orandea/impl/bbb" , expected: normalize " ../../impl/bbb" }
13+ rel <- relative " /data/orandea/test/aaa" " /data/orandea/impl/bbb"
14+ assertEqual { actual: rel, expected: normalize " ../../impl/bbb" }
1415 assertEqual { actual: dirname " /foo/bar/baz/asdf/quux" , expected: normalize " /foo/bar/baz/asdf" }
1516 assertEqual { actual: basename " /foo/bar/baz/asdf/quux.html" , expected: " quux.html" }
1617 assertEqual { actual: basenameWithoutExt " /foo/bar/baz/asdf/quux.html" " .html" , expected: " quux" }
You can’t perform that action at this time.
0 commit comments