summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralisdair sullivan <alisdairsullivan@yahoo.ca>2015-02-24 22:10:21 -0800
committeralisdair sullivan <alisdairsullivan@yahoo.ca>2015-03-03 01:57:55 -0800
commitaf7ba345fa3507df511ed192eb8305e9e247bf97 (patch)
tree0fc718b8bc04f9033624fa457551332ca7f49428 /src
parent0e606138c5cd9a636a1954945fa0a03c267ef9c6 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_cover.erl3
1 files changed, 3 insertions, 0 deletions
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, "</table>\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))).