diff options
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r-- | src/rebar_utils.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index ffa29e6..cc59ed0 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -48,6 +48,7 @@ erl_opts/1, indent/1, update_code/1, + remove_from_code_path/1, cleanup_code_path/1, args_to_tasks/1, expand_env_variable/3, @@ -581,6 +582,22 @@ update_code(Paths) -> end end, Paths). +remove_from_code_path(Paths) -> + lists:foreach(fun(Path) -> + Name = filename:basename(Path, "/ebin"), + App = list_to_atom(Name), + application:load(App), + case application:get_key(App, modules) of + undefined -> + application:unload(App), + ok; + {ok, Modules} -> + application:unload(App), + [begin code:purge(M), code:delete(M) end || M <- Modules] + end, + code:del_path(Path) + end, Paths). + cleanup_code_path(OrigPath) -> CurrentPath = code:get_path(), AddedPaths = CurrentPath -- OrigPath, |