erlang - Escript: setting code path relative to script directory -
when try set relative code path in escript -pz this
#!/usr/bin/env escript %% -*- erlang -*- %%! -pz ../dir-of-some-beams
the path interpreted relative directory run escript from, renders useless setting path relative script location.
my current "workaround" using absolute path annoying since part of repository , don't want location dependent.
so how can set code path relative directory escript located in?
just found out myself:
at beginning of main add code this:
true = code:add_pathz(filename:dirname(escript:script_name()) ++ "/../dir-of-some-beams"),
i recommend testing true
whith these code
functions, because easy type code:add_pathsz
wants list of strings , returns ok
, if pass string -- doesn't set code path single directory (which pretty annoying behaviour btw).
Comments
Post a Comment