aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric B Merritt <[email protected]>2013-02-05 17:07:21 -0800
committerEric B Merritt <[email protected]>2013-02-06 14:21:34 -0800
commit35040be995d9b2f1b3b601e69a998156145e1b35 (patch)
tree5f167ee788c135e876216955f2f5b29539bbd3a3
parent2436289d373f16648a9768d66a658c42b2a91781 (diff)
downloadrelx-35040be995d9b2f1b3b601e69a998156145e1b35.tar.gz
relx-35040be995d9b2f1b3b601e69a998156145e1b35.tar.bz2
relx-35040be995d9b2f1b3b601e69a998156145e1b35.zip
fix bug in on disk overriding the default release
-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