diff options
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r-- | src/rebar_utils.erl | 12 |
1 files changed, 12 insertions, 0 deletions
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 -> |