Skip to content

Commit

Permalink
Fix behaviours' impls lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
fenek committed May 8, 2019
1 parent ab46087 commit fe323c1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mongoose_lib.erl
Expand Up @@ -18,11 +18,12 @@
-spec find_behaviour_implementations(Behaviour :: module()) -> [module()].
find_behaviour_implementations(Behaviour) ->
{ok, EbinFiles} = file:list_dir(code:lib_dir(mongooseim, ebin)),
Mods = [ list_to_existing_atom(filename:rootname(File))
Mods = [ list_to_atom(filename:rootname(File))
|| File <- EbinFiles, filename:extension(File) == ".beam" ],
lists:filter(fun(M) ->
try lists:keyfind([Behaviour], 2, M:module_info(attributes)) of
{Key, _} when Key == behaviour; Key == behavior -> true;
{behavior, _} -> true;
{behaviour, _} -> true;
_ -> false
catch
_:_ -> false
Expand Down

0 comments on commit fe323c1

Please sign in to comment.