aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_prv_app_discover.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2015-01-06 18:32:32 -0600
committerTristan Sloughter <[email protected]>2015-01-06 18:32:32 -0600
commitc215312707728f0b50f4dd71e7ac9b4305850bad (patch)
tree44dd2a1ee286adb9b41ac9351aec3edd52300f28 /src/rlx_prv_app_discover.erl
parentba9309ca2431df62ab6a0008ae5a96a165675d2b (diff)
downloadrelx-c215312707728f0b50f4dd71e7ac9b4305850bad.tar.gz
relx-c215312707728f0b50f4dd71e7ac9b4305850bad.tar.bz2
relx-c215312707728f0b50f4dd71e7ac9b4305850bad.zip
remove duplicates without changing order of list for lib dirs
Diffstat (limited to 'src/rlx_prv_app_discover.erl')
-rw-r--r--src/rlx_prv_app_discover.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rlx_prv_app_discover.erl b/src/rlx_prv_app_discover.erl
index 9a5da4d..b5226ad 100644
--- a/src/rlx_prv_app_discover.erl
+++ b/src/rlx_prv_app_discover.erl
@@ -55,7 +55,7 @@ init(State) ->
%% looking for OTP Applications
-spec do(rlx_state:t()) -> {ok, rlx_state:t()} | relx:error().
do(State0) ->
- LibDirs = lists:usort(get_lib_dirs(State0)),
+ LibDirs = dedup(get_lib_dirs(State0)),
case rlx_app_discovery:do(State0, LibDirs) of
{ok, AppMeta} ->
State1 = rlx_state:available_apps(State0, AppMeta),
@@ -131,3 +131,9 @@ add_system_lib_dir(State) ->
SystemLibs ->
erlang:iolist_to_binary(SystemLibs)
end.
+
+%% Order matters so this slow dedup needs to be used
+dedup([]) ->
+ [];
+dedup([H|T]) ->
+ [H | [X || X <- dedup(T), X /= H]].