Adapt for running from escript (fix).
This commit is contained in:
@@ -792,6 +792,7 @@ value_to_sql(X) -> sqlite3_lib:value_to_sql(X).
|
||||
-spec init([any()]) -> {'ok', #state{}} | {'stop', string()}.
|
||||
init(Options) ->
|
||||
PrivDir = get_priv_dir(),
|
||||
io:format("PrivDir = ~p~n", [PrivDir]),
|
||||
case erl_ddll:load(PrivDir, atom_to_list(?DRIVER_NAME)) of
|
||||
ok ->
|
||||
do_init(Options);
|
||||
@@ -1075,6 +1076,8 @@ get_priv_dir() ->
|
||||
case is_escript() of
|
||||
{true,Escript} ->
|
||||
io:format("Escript = ~p~n", [Escript]),
|
||||
Which = code:which(sqlite3),
|
||||
io:format("Which = ~p~n", [Which]),
|
||||
{Pref,Suf} = lists:split(erlang:length(Escript), Which),
|
||||
io:format("Pref = ~p~n", [Pref]),
|
||||
io:format("Suf = ~p~n", [Suf]),
|
||||
|
||||
Reference in New Issue
Block a user