sqlite-erlang icon indicating copy to clipboard operation
sqlite-erlang copied to clipboard

priv dir must be on PATH in order to use sqlite-erlang

Open pmahoney opened this issue 15 years ago • 0 comments

In order to use sqlite-erlang, the priv dir containing the sqlite-port executable must be on the PATH environment variable. The following patch solves the problem (I hope the formatting comes out correctly...).

Edit: unfortunately, this only seems to work when sqlite is in ERL_LIBS environment variable or an absolute path is given to -pa. code:priv_dir/1 doesn't work with relative paths specified like -pa ebin.

diff --git a/src/sqlite.erl b/src/sqlite.erl
index 0bdb7c9..3a2736c 100644
--- a/src/sqlite.erl
+++ b/src/sqlite.erl
@@ -442,7 +442,7 @@ code_change(_OldVsn, State, _Extra) ->
 %%--------------------------------------------------------------------

 create_cmd(Dbase) ->
-    "sqlite_port " ++ Dbase.
+    filename:join([code:priv_dir(?MODULE), "sqlite_port "]) ++ Dbase.

 exec(Port, Cmd) ->
     port_command(Port, term_to_binary(Cmd)),

pmahoney avatar Jul 11 '09 04:07 pmahoney