25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Generate ejabberd lib dir when not available in code server (#1665)

This is the case if running ejabberd from development directory
when code:lib_dir(ejabberd) returns {error, nad_name}.
This commit is contained in:
Christophe Romain 2017-04-07 12:09:43 +02:00
parent 2a6c50832e
commit 36e3f4bc2a

View File

@ -541,9 +541,22 @@ compile_result(Results) ->
compile_options() ->
[verbose, report_errors, report_warnings]
++ [{i, filename:join(code:lib_dir(App), "include")}
++ [{i, filename:join(app_dir(App), "include")}
|| App <- [fast_xml, xmpp, ejabberd]].
app_dir(App) ->
case code:lib_dir(App) of
{error, bad_name} ->
case code:which(App) of
Beam when is_list(Beam) ->
filename:dirname(filename:dirname(Beam));
_ ->
"."
end;
Dir ->
Dir
end.
compile_erlang_file(Dest, File) ->
compile_erlang_file(Dest, File, compile_options()).