Adapt for running from escript (fix).

This commit is contained in:
Anton Makarov
2025-09-10 13:58:51 +03:00
parent 842bc984fb
commit 4cdb6c53f8

View File

@@ -110,6 +110,18 @@ get_priv_dir() ->
Dir Dir
end. end.
%% @private
is_escript() ->
case erlang:function_exported(escript, script_name, 0) of
true ->
try
{true, filename:absname(escript:script_name())}
catch
_:_ -> false
end;
false -> false
end.
%% @doc Open the specified sqlite3 database. %% @doc Open the specified sqlite3 database.
%% It is possible to use sqlite's uri filenames to open files. %% It is possible to use sqlite's uri filenames to open files.
%% See: [https://sqlite.org/uri.html] for more information. %% See: [https://sqlite.org/uri.html] for more information.