summaryrefslogtreecommitdiff
path: root/src/rebar_app_info.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2017-02-24 18:41:07 -0500
committerGitHub <noreply@github.com>2017-02-24 18:41:07 -0500
commit7918be19c36a7a81721a0e88f7f32df4cea81a3f (patch)
tree4ca77dcd8bb2529ce4ea9a12651b3c0db7c5fa8b /src/rebar_app_info.erl
parent4725d363c5b5583c9910f078da38c5b3a1d97aab (diff)
parentab1f93d6fa712c3b85bce30cab09edb5ddf7f3d9 (diff)
Merge pull request #1486 from ferd/src_dir-is-respected
Add respect for src_dirs option in app_discover and app_info
Diffstat (limited to 'src/rebar_app_info.erl')
-rw-r--r--src/rebar_app_info.erl13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl
index fdaadb8..62ec6dd 100644
--- a/src/rebar_app_info.erl
+++ b/src/rebar_app_info.erl
@@ -248,13 +248,12 @@ set(AppInfo=#app_info_t{opts=Opts}, Key, Value) ->
%% @doc finds the .app.src file for an app, if any.
-spec app_file_src(t()) -> file:filename_all() | undefined.
-app_file_src(#app_info_t{app_file_src=undefined, dir=Dir, name=Name}) ->
- AppFileSrc = filename:join([ec_cnv:to_list(Dir), "src", ec_cnv:to_list(Name)++".app.src"]),
- case filelib:is_file(AppFileSrc) of
- true ->
- AppFileSrc;
- false ->
- undefined
+app_file_src(#app_info_t{app_file_src=undefined, dir=Dir, name=Name, opts=Opts}) ->
+ CandidatePaths = [filename:join([ec_cnv:to_list(Dir), Src, ec_cnv:to_list(Name)++".app.src"])
+ || Src <- rebar_opts:get(Opts, src_dirs, ["src"])],
+ case lists:dropwhile(fun(Path) -> not filelib:is_file(Path) end, CandidatePaths) of
+ [] -> undefined;
+ [AppFileSrc|_] -> AppFileSrc
end;
app_file_src(#app_info_t{app_file_src=AppFileSrc}) ->
ec_cnv:to_list(AppFileSrc).