From a4d4c6ca63928402363fe3fcbd2b1b615a3b7e42 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 17 Sep 2014 18:28:44 -0500 Subject: fix support for r15 --- src/rebar_app_discover.erl | 6 +++--- src/rebar_utils.erl | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') 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 -> -- cgit v1.1