diff options
author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-05-29 09:50:52 -0500 |
---|---|---|
committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-05-29 09:50:52 -0500 |
commit | a11c009fcfe02fb7741bb7ce0c8ebaf2141ffd8d (patch) | |
tree | 46780e6f6e31ab9e9f4cc0b8b84659c92adf509d /src/rebar_utils.erl | |
parent | a9a8c6a3debc76f4e0057652f94aea0f66320ecf (diff) | |
parent | 6c6940f860139cae0b719e0e1d7f8ed37171ba59 (diff) |
Merge pull request #474 from tsloughter/fix_plugin_install
fixing plugin install and paths
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, |