summaryrefslogtreecommitdiff
path: root/src/rebar_otp_app.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_otp_app.erl')
-rw-r--r--src/rebar_otp_app.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl
index 36af4cd..e850e58 100644
--- a/src/rebar_otp_app.erl
+++ b/src/rebar_otp_app.erl
@@ -167,18 +167,22 @@ ebin_modules(App, Dir) ->
beam_src(Beam) ->
try
+ Mod = list_to_atom(filename:basename(Beam, ".beam")),
+ _ = purge(Mod),
{module, Mod} = code:load_abs(filename:rootname(Beam, ".beam")),
Compile = Mod:module_info(compile),
- %% completely purge module so any other attempts to load it succeed
- _ = code:purge(Mod),
- _ = code:delete(Mod),
- _ = code:purge(Mod),
proplists:get_value(source, Compile, [])
catch
error:undef -> [];
error:nofile -> []
end.
+purge(Mod) ->
+ %% remove old code if necessary
+ _ = code:purge(Mod),
+ %% move current code to old
+ _ = code:delete(Mod).
+
ensure_registered(AppData) ->
case lists:keyfind(registered, 1, AppData) of
false ->