Extend app resource file existence checks

This commit is contained in:
Tuncer Ayaz 2011-07-24 22:36:03 +02:00
parent 5f2930b701
commit f08f13d103

View file

@ -45,18 +45,26 @@ is_app_dir() ->
is_app_dir(rebar_utils:get_cwd()).
is_app_dir(Dir) ->
AppSrc = filename:join([Dir, "src", "*.app.src"]),
SrcDir = filename:join([Dir, "src"]),
AppSrc = filename:join([SrcDir, "*.app.src"]),
case filelib:wildcard(AppSrc) of
[AppSrcFile] ->
{true, AppSrcFile};
_ ->
App = filename:join([Dir, "ebin", "*.app"]),
[] ->
EbinDir = filename:join([Dir, "ebin"]),
App = filename:join([EbinDir, "*.app"]),
case filelib:wildcard(App) of
[AppFile] ->
{true, AppFile};
[] ->
false;
_ ->
?ERROR("More than one .app file in ~s~n", [EbinDir]),
false
end;
_ ->
?ERROR("More than one .app.src file in ~s~n", [SrcDir]),
false
end
end.