aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_prv_discover.erl
diff options
context:
space:
mode:
authorEric <[email protected]>2012-09-19 18:50:56 -0700
committerEric <[email protected]>2012-09-19 18:50:56 -0700
commit13b65ac87e281e846820bbef8df1a94b81fcb5ef (patch)
tree2ac4836c41daf501bf2c156d49e61a67aaba3e29 /src/rcl_prv_discover.erl
parent6ee94839094b00163e5f0a29a41dedb9ae67ca85 (diff)
downloadrelx-13b65ac87e281e846820bbef8df1a94b81fcb5ef.tar.gz
relx-13b65ac87e281e846820bbef8df1a94b81fcb5ef.tar.bz2
relx-13b65ac87e281e846820bbef8df1a94b81fcb5ef.zip
discover should not discover files in the output dir
Diffstat (limited to 'src/rcl_prv_discover.erl')
-rw-r--r--src/rcl_prv_discover.erl18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/rcl_prv_discover.erl b/src/rcl_prv_discover.erl
index a7d7e1e..ab4011c 100644
--- a/src/rcl_prv_discover.erl
+++ b/src/rcl_prv_discover.erl
@@ -42,6 +42,7 @@ init(State) ->
%% looking for OTP Applications
-spec do(rcl_state:t()) -> {ok, rcl_state:t()} | relcool:error().
do(State) ->
+ OutputDir = rcl_state:output_dir(State),
LibDirs = get_lib_dirs(State),
rcl_log:info(rcl_state:log(State),
fun() ->
@@ -49,7 +50,10 @@ do(State) ->
[[rcl_util:indent(1), LibDir, "\n"] || LibDir <- LibDirs]]
end),
- AppMeta0 = lists:flatten(ec_plists:map(fun discover_dir/1, LibDirs)),
+ AppMeta0 = lists:flatten(ec_plists:map(fun(LibDir) ->
+ discover_dir([OutputDir],
+ LibDir)
+ end, LibDirs)),
Errors = [case El of
{error, Ret} -> Ret;
_ -> El
@@ -148,17 +152,21 @@ format_detail({unversioned_app, AppDir, _AppName}) ->
format_detail({app_info_error, Detail}) ->
rcl_app_info:format_error(Detail).
--spec discover_dir(file:name()) ->
+-spec discover_dir([file:name()],
+ file:name()) ->
[rcl_app_info:t() | {error, Reason::term()}] |
rcl_app_info:t() | {error, Reason::term()}.
-discover_dir(File) ->
- case filelib:is_dir(File) of
+discover_dir(IgnoreDirs, File) ->
+ case (not lists:member(File, IgnoreDirs))
+ andalso filelib:is_dir(File) of
true ->
case file:list_dir(File) of
{error, Reason} ->
{error, {accessing, File, Reason}};
{ok, List} ->
- ec_plists:map(fun discover_dir/1, [filename:join([File, Dir]) || Dir <- List])
+ ec_plists:map(fun(LibDir) ->
+ discover_dir(IgnoreDirs, LibDir)
+ end, [filename:join([File, Dir]) || Dir <- List])
end;
false ->
is_valid_otp_app(File)