Fix statrt for cases when application not running.
This commit is contained in:
parent
38643c5fb4
commit
7768ac22e0
1 changed files with 10 additions and 1 deletions
|
@ -2106,7 +2106,7 @@ stop() ->
|
|||
%% ====================================================================
|
||||
|
||||
init() ->
|
||||
case erl_ddll:load_driver(code:priv_dir(bdberl), bdberl_drv) of
|
||||
case erl_ddll:load_driver(priv_dir(), bdberl_drv) of
|
||||
ok -> ok;
|
||||
{error, permanent} -> ok % Means that the driver is already active
|
||||
end,
|
||||
|
@ -2125,6 +2125,15 @@ init() ->
|
|||
erlang:put(bdb_port, Port),
|
||||
Port.
|
||||
|
||||
priv_dir() ->
|
||||
case code:priv_dir(?MODULE) of
|
||||
Name when is_list(Name) ->
|
||||
Name;
|
||||
{error, bad_name} ->
|
||||
{ok, Cwd} = file:get_cwd(),
|
||||
filename:absname(filename:join(Cwd, "../priv"))
|
||||
end.
|
||||
|
||||
get_port() ->
|
||||
case erlang:get(bdb_port) of
|
||||
undefined -> init();
|
||||
|
|
Loading…
Reference in a new issue