Skip to content

Commit

Permalink
genercise into rebar_utils:is_list_of_string/1
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Paxton committed Jun 8, 2018
1 parent 3f644d2 commit 1b0d28a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/rebar_erlc_compiler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -798,9 +798,12 @@ dir_recursive(Opts, Dir, CompileOpts) when is_list(CompileOpts) ->
Recursive -> Recursive
end.

valid_erl_first_conf(FileList) when not is_list(hd(FileList)) ->
?ABORT("An invalid file list (~p) was provided as part of your erl_files_first directive", [FileList]);
valid_erl_first_conf(FileList) when is_list(hd(FileList)) ->
true;
valid_erl_first_conf(FileList) when is_list(FileList) ->
true.
valid_erl_first_conf(FileList) ->
case FileList of
[] -> ?WARN("An empty file list (~p) was provided as part of your erl_files_first directive", [FileList]);
List -> case rebar_utils:is_list_of_strings(List) of
true -> true;
false -> ?ABORT("An invalid file list (~p) was provided as part of your erl_files_first directive",
[FileList])
end
end.
11 changes: 10 additions & 1 deletion src/rebar_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
list_dir/1,
user_agent/0,
reread_config/1,
get_proxy_auth/0]).
get_proxy_auth/0,
is_list_of_strings/1]).


%% for internal use only
Expand Down Expand Up @@ -919,3 +920,11 @@ get_proxy_auth() ->
undefined -> [];
{ok, ProxyAuth} -> ProxyAuth
end.

-spec rebar_utils:is_list_of_strings(term()) -> boolean().
is_list_of_strings(List) when not is_list(hd(List)) ->
false;
is_list_of_strings(List) when is_list(hd(List)) ->
true;
is_list_of_strings(List) when is_list(List) ->
true.

0 comments on commit 1b0d28a

Please sign in to comment.