File tree Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ defmodule Exception do
176
176
file = to_binary ( file )
177
177
178
178
if cwd do
179
- file = :binary . replace ( file , cwd <> "/" , "" )
179
+ file = Path . relative_to ( file , cwd )
180
180
end
181
181
182
182
if line && line != 0 do
Original file line number Diff line number Diff line change @@ -120,8 +120,8 @@ defmodule Path do
120
120
relative_to ( t1 , t2 , original )
121
121
end
122
122
123
- defp relative_to ( t1 , [ ] , _original ) do
124
- FN . join ( t1 )
123
+ defp relative_to ( [ _ | _ ] = l1 , [ ] , _original ) do
124
+ FN . join ( l1 )
125
125
end
126
126
127
127
defp relative_to ( _ , _ , original ) do
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ defmodule PathTest do
57
57
assert Path . relative_to ( "/usr/local/foo" , "/usr/local" ) == "foo"
58
58
assert Path . relative_to ( "/usr/local/foo" , "/" ) == "usr/local/foo"
59
59
assert Path . relative_to ( "/usr/local/foo" , "/etc" ) == "/usr/local/foo"
60
+ assert Path . relative_to ( "/usr/local/foo" , "/usr/local/foo" ) == "/usr/local/foo"
60
61
61
62
assert Path . relative_to ( "usr/local/foo" , "usr/local" ) == "foo"
62
63
assert Path . relative_to ( "usr/local/foo" , "etc" ) == "usr/local/foo"
You can’t perform that action at this time.
0 commit comments