From 35040be995d9b2f1b3b601e69a998156145e1b35 Mon Sep 17 00:00:00 2001 From: Eric B Merritt Date: Tue, 5 Feb 2013 17:07:21 -0800 Subject: fix bug in on disk overriding the default release --- src/rcl_prv_discover.erl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/rcl_prv_discover.erl b/src/rcl_prv_discover.erl index c5a625d..2f88354 100644 --- a/src/rcl_prv_discover.erl +++ b/src/rcl_prv_discover.erl @@ -48,9 +48,8 @@ do(State0) -> case rcl_rel_discovery:do(State0, LibDirs, AppMeta) of {ok, Releases} -> State1 = rcl_state:available_apps(State0, AppMeta), - State3 = lists:foldl(fun(Rel, State2) -> - rcl_state:add_release(State2, Rel) - end, State1, Releases), + State3 = lists:foldl(fun add_if_not_found/2, + State1, Releases), {ok, State3}; Error -> Error @@ -68,6 +67,18 @@ format_error(_) -> %%%=================================================================== %%% Internal Functions %%%=================================================================== +%% @doc only add the release if its not documented in the system +add_if_not_found(Rel, State) -> + RelName = rcl_release:name(Rel), + RelVsn = rcl_release:vsn(Rel), + try + rcl_state:get_release(State, RelName, RelVsn), + State + catch + throw:not_found -> + rcl_state:add_release(State, Rel) + end. + get_lib_dirs(State) -> LibDirs0 = rcl_state:lib_dirs(State), case rcl_state:get(State, disable_default_libs, false) of -- cgit v1.2.3