From af7ba345fa3507df511ed192eb8305e9e247bf97 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Tue, 24 Feb 2015 22:10:21 -0800 Subject: erlang r15x (and possibly earlier) don't put the correct path to source files in the `compile` key of `module_info/1` so `rebar cover` struggles locating source in some instances. in these cases a warning is printed and crappy coverage info is written rather than none at all --- src/rebar_prv_cover.erl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/rebar_prv_cover.erl b/src/rebar_prv_cover.erl index 791e4e9..765e2ac 100644 --- a/src/rebar_prv_cover.erl +++ b/src/rebar_prv_cover.erl @@ -250,6 +250,9 @@ write_index_section(F, [{Section, DataFile, Mods}|Rest]) -> ok = file:write(F, "\n"), write_index_section(F, Rest). +%% fix for r15b which doesn't put the correct path in the `source` section +%% of `module_info(compile)` +strip_coverdir([]) -> ""; strip_coverdir(File) -> filename:join(lists:reverse(lists:sublist(lists:reverse(filename:split(File)), 2))). -- cgit v1.1