diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-05-25 23:23:29 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-05-27 20:02:04 -0500 |
commit | 20f4562c6dabfcf9df1e52ec2c83307b33c24090 (patch) | |
tree | daa894e5efb10b215321bfb983f64ca579b88f00 /src/rebar_utils.erl | |
parent | 8687ddc14a20606fafdd666ee058932b361e5113 (diff) |
fix for plugin installation and code 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, |