]> granicus.if.org Git - ejabberd/commitdiff
Report meaningful error when luerl is not available
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 19 Mar 2018 17:09:35 +0000 (20:09 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 19 Mar 2018 17:09:35 +0000 (20:09 +0300)
src/prosody2ejabberd.erl

index 62cb324173757f3c2b67c0215d532fd7cf71b4cd..cfee9ae0136ce47de6159f4b06296831f5118d07 100644 (file)
 %%% 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.