Add Path.relative_to_cwd and rely on it when generating stacktraces

This commit is contained in:
José Valim
2013-08-14 12:36:54 +02:00
parent e2ef1ae8de
commit db47bd56b4
28 changed files with 121 additions and 116 deletions
+3 -3
View File
@@ -8,7 +8,7 @@
assert_no_match_scope/3, assert_no_guard_scope/3,
assert_no_match_or_guard_scope/3, warn/1,
handle_file_warning/2, handle_file_warning/3, handle_file_error/2,
deprecation/3, deprecation/4, file_format/3]).
deprecation/3, deprecation/4]).
-include("elixir.hrl").
warn(Warning) ->
@@ -209,10 +209,10 @@ raise(Line, File, Kind, Message) when is_integer(Line) ->
erlang:raise(error, Exception, tl(Stacktrace)).
file_format(0, File, Message) ->
io_lib:format("~ts: ~ts~n", [File, Message]);
io_lib:format("~ts: ~ts~n", [elixir_helpers:relative_to_cwd(File), Message]);
file_format(Line, File, Message) ->
io_lib:format("~ts:~w: ~ts~n", [File, Line, Message]).
io_lib:format("~ts:~w: ~ts~n", [elixir_helpers:relative_to_cwd(File), Line, Message]).
format_var(Var) ->
list_to_atom(lists:takewhile(fun(X) -> X /= $@ end, atom_to_list(Var))).