Adapt for running from escript (remove debug output).
This commit is contained in:
@@ -792,7 +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]),
|
||||
%io:format("PrivDir = ~p~n", [PrivDir]),
|
||||
case erl_ddll:load(PrivDir, atom_to_list(?DRIVER_NAME)) of
|
||||
ok ->
|
||||
do_init(Options);
|
||||
@@ -1075,15 +1075,15 @@ get_priv_dir() ->
|
||||
%% application isn't in path, fall back
|
||||
case is_escript() of
|
||||
{true,Escript} ->
|
||||
io:format("Escript = ~p~n", [Escript]),
|
||||
%io:format("Escript = ~p~n", [Escript]),
|
||||
Which = code:which(sqlite3),
|
||||
io:format("Which = ~p~n", [Which]),
|
||||
%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]),
|
||||
%io:format("Pref = ~p~n", [Pref]),
|
||||
%io:format("Suf = ~p~n", [Suf]),
|
||||
RootDir = filename:dirname(filename:dirname(Pref)),
|
||||
AppsDir = filename:join(RootDir, "lib"),
|
||||
io:format("AppsDir = ~p~n", [AppsDir]),
|
||||
%io:format("AppsDir = ~p~n", [AppsDir]),
|
||||
SqDir = filename:dirname(filename:dirname(Suf)),
|
||||
filename:join([AppsDir, [$.|SqDir], "priv"]); % prepend "." to suffix that starts with "/"
|
||||
false ->
|
||||
|
||||
Reference in New Issue
Block a user