Skip to content

Commit

Permalink
Improved NIF initialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
davisp committed Jun 13, 2011
1 parent 5846159 commit f94c7af
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/jiffy.erl
Expand Up @@ -79,18 +79,15 @@ finish_encode(_, _) ->


init() ->
SoName = case code:priv_dir(?MODULE) of
{error, bad_name} ->
case filelib:is_dir(filename:join(["..", priv])) of
true ->
filename:join(["..", priv, ?MODULE]);
_ ->
filename:join([priv, ?MODULE])
end;
Dir ->
filename:join(Dir, ?MODULE)
PrivDir = case code:priv_dir(?MODULE) of
{error, _} ->
EbinDir = filename:dirname(code:which(?MODULE)),
AppPath = filename:dirname(EbinDir),
filename:join(AppPath, "priv");
Path ->
Path
end,
erlang:load_nif(SoName, 0).
erlang:load_nif(filename:join(PrivDir, "jiffy"), 0).


not_loaded(Line) ->
Expand Down

0 comments on commit f94c7af

Please sign in to comment.