Fix statrt for cases when application not running.

This commit is contained in:
Sergey Yelin 2011-07-18 16:04:06 +04:00
parent 38643c5fb4
commit 7768ac22e0

View file

@ -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();