From 3356c2d9e87c9bbad082bd3eeccecea0b6cc4358 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Mon, 21 Feb 2011 17:42:10 +0100 Subject: Use erlang:function_exported/3 --- src/rebar_core.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/rebar_core.erl') diff --git a/src/rebar_core.erl b/src/rebar_core.erl index db3e0b4..b390dc0 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -280,8 +280,8 @@ expand_lib_dirs([Dir | Rest], Root, Acc) -> select_modules([], _Command, Acc) -> lists:reverse(Acc); select_modules([Module | Rest], Command, Acc) -> - Exports = Module:module_info(exports), - case lists:member({Command, 2}, Exports) of + {module, Module} = code:ensure_loaded(Module), + case erlang:function_exported(Module, Command, 2) of true -> select_modules(Rest, Command, [Module | Acc]); false -> -- cgit v1.1 From 58661a92e205b44a5090f9a2c4371a94bab692ec Mon Sep 17 00:00:00 2001 From: Juan Jose Comellas Date: Tue, 22 Feb 2011 01:58:46 -0300 Subject: Convert the entries in the code path to absolute paths Rebar will exit with {error,bad_directory} when trying to restore the code path after it has finished working on a subdirectory if there are invalid relative paths in it. The problem was seen when executing the last line of rebar_erlc_compiler:doterl_compile/3 (true = code:set_path(CurrPath)). --- src/rebar_core.erl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/rebar_core.erl') diff --git a/src/rebar_core.erl b/src/rebar_core.erl index b390dc0..d92af34 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -76,6 +76,10 @@ process_commands([Command | Rest]) -> lists:foreach(fun (D) -> erlang:erase({skip_dir, D}) end, skip_dirs()), Operations = erlang:get(operations), + %% Convert the code path so that all the entries are absolute paths. + %% If not, code:set_path() may choke on invalid relative paths when trying + %% to restore the code path from inside a subdirectory. + true = rebar_utils:expand_code_path(), _ = process_dir(rebar_utils:get_cwd(), rebar_config:new(), Command, sets:new()), case erlang:get(operations) of -- cgit v1.1