summaryrefslogtreecommitdiff
path: root/src/prosody2ejabberd.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-03-19 20:09:35 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-03-19 20:09:35 +0300
commit8962397cf30ec34e58f88a2d55fd4cbd4c537790 (patch)
tree603e34da42fbfd723588a00f86fc0c5b4c10b764 /src/prosody2ejabberd.erl
parentSet -protocol() directive for mod_avatar (diff)
Report meaningful error when luerl is not available
Diffstat (limited to 'src/prosody2ejabberd.erl')
-rw-r--r--src/prosody2ejabberd.erl41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/prosody2ejabberd.erl b/src/prosody2ejabberd.erl
index 62cb3241..cfee9ae0 100644
--- a/src/prosody2ejabberd.erl
+++ b/src/prosody2ejabberd.erl
@@ -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.