Skip to content

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

@pmahoney

Description

@pmahoney

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)),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions