aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rcl_prv_discover.erl17
1 files 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