aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_prv_discover.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2013-02-07 04:57:36 -0800
committerTristan Sloughter <[email protected]>2013-02-07 04:57:36 -0800
commit6734e9ec4e0dd4c0678d10e8b8e48552ffb4e995 (patch)
tree93feb4e317d35d9d69443551b83175d21a0a0808 /src/rcl_prv_discover.erl
parent60b074edbb09b43618febdf8eb50a330db2aa677 (diff)
parent35040be995d9b2f1b3b601e69a998156145e1b35 (diff)
downloadrelx-6734e9ec4e0dd4c0678d10e8b8e48552ffb4e995.tar.gz
relx-6734e9ec4e0dd4c0678d10e8b8e48552ffb4e995.tar.bz2
relx-6734e9ec4e0dd4c0678d10e8b8e48552ffb4e995.zip
Merge pull request #27 from ericbmerritt/next
lots of bug fixes
Diffstat (limited to 'src/rcl_prv_discover.erl')
-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