25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Report meaningful error when luerl is not available

This commit is contained in:
Evgeniy Khramtsov 2018-03-19 20:09:35 +03:00
parent b1ecd8ac01
commit 8962397cf3

View File

@ -38,23 +38,30 @@
%%% API
%%%===================================================================
from_dir(ProsodyDir) ->
case file:list_dir(ProsodyDir) of
{ok, HostDirs} ->
lists:foreach(
fun(HostDir) ->
Host = list_to_binary(HostDir),
lists:foreach(
fun(SubDir) ->
Path = filename:join(
[ProsodyDir, HostDir, SubDir]),
convert_dir(Path, Host, SubDir)
end, ["vcard", "accounts", "roster",
"private", "config", "offline",
"privacy", "pep", "pubsub"])
end, HostDirs);
{error, Why} = Err ->
?ERROR_MSG("failed to list ~s: ~s",
[ProsodyDir, file:format_error(Why)]),
case code:ensure_loaded(luerl) of
{module, _} ->
case file:list_dir(ProsodyDir) of
{ok, HostDirs} ->
lists:foreach(
fun(HostDir) ->
Host = list_to_binary(HostDir),
lists:foreach(
fun(SubDir) ->
Path = filename:join(
[ProsodyDir, HostDir, SubDir]),
convert_dir(Path, Host, SubDir)
end, ["vcard", "accounts", "roster",
"private", "config", "offline",
"privacy", "pep", "pubsub"])
end, HostDirs);
{error, Why} = Err ->
?ERROR_MSG("failed to list ~s: ~s",
[ProsodyDir, file:format_error(Why)]),
Err
end;
{error, _} = Err ->
?INFO_MSG("The file 'luerl.beam' is not found: maybe "
"ejabberd is not compiled with Lua support", []),
Err
end.