summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_app_discover.erl6
-rw-r--r--src/rebar_utils.erl12
2 files changed, 15 insertions, 3 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index aac8380..c90a8df 100644
--- a/src/rebar_app_discover.erl
+++ b/src/rebar_app_discover.erl
@@ -51,9 +51,9 @@ find_apps(LibDirs) ->
find_apps(LibDirs, valid).
find_apps(LibDirs, Validate) ->
- lists:filtermap(fun(AppDir) ->
- find_app(AppDir, Validate)
- end, all_app_dirs(LibDirs)).
+ rebar_utils:filtermap(fun(AppDir) ->
+ find_app(AppDir, Validate)
+ end, all_app_dirs(LibDirs)).
find_app(AppDir, Validate) ->
AppFile = filelib:wildcard(filename:join([AppDir, "ebin", "*.app"])),
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index fa0a005..b83c03e 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -27,6 +27,7 @@
-module(rebar_utils).
-export([droplast/1,
+ filtermap/2,
get_cwd/0,
is_arch/1,
get_arch/0,
@@ -85,6 +86,17 @@ get_cwd() ->
{ok, Dir} = file:get_cwd(),
Dir.
+filtermap(F, [Hd|Tail]) ->
+ case F(Hd) of
+ true ->
+ [Hd|filtermap(F, Tail)];
+ {true,Val} ->
+ [Val|filtermap(F, Tail)];
+ false ->
+ filtermap(F, Tail)
+ end;
+filtermap(F, []) when is_function(F, 1) -> [].
+
is_arch(ArchRegex) ->
case re:run(get_arch(), ArchRegex, [{capture, none}]) of
match ->