I'm not familiar with this verb, is the any adverse effect if the line
y=. sel ndx } y
is replaced with
if. fexist sel do. y=. sel ndx } y end.
On Sun, 23 Aug 2009, bill lam wrote:
> I found that getscripts assume script name without '.' and not part of
> PUBLIC to be under ~addons As reproduced using an executable script
>
> jtest1:
> #/path/to/jconsole
> exit 0
>
> If this is invoked with ./jtest1 or the name changed to jtest1.j so
> that there is a '.' then it run ok. However if that is invoked just
> by jtest1 (jtest1 inside $PATH) then getscripts verb will change the
> name to something
>
> .../addons//.../jtest1.ijs
>
> I suggest changing getscripts so that it actually match files inside
> ~addons otherwise leaves y unchanged. Or alternatively change
> behavior of #! script to use 0!:0 instead of script_z_ for execution.
>
>
> getscripts=: 3 : 0
> if. 0=#y do. '' return. end.
> if. 0=L.y do.
> if. fexist y do.
> y=. <y
> else.
> y=. cutnames y
> end.
> end.
> if. 0=#y do. '' return. end.
> ndx=. ({."1 PUBLIC) i. y
> ind=. I. ndx < # PUBLIC
> y=. ((ind { ndx) { 1 {"1 PUBLIC) ind } y
> ind=. (i.#y) -. ind
> if. #ind do. <==== fallen inside this loop
> sel=. ind { y
> msk=. -. '.' e. &> sel <=== check for any '.' inside script pathname
> cnt=. +/ &> sel e. each <'/\'
> ndx=. ind #~ msk *. cnt=1
> y=. (addfname each ndx { y) ndx } y
> ndx=. ind #~ msk *. cnt > 0
> sel=. (<'~addons/') ,each (ndx{y) ,each <'.ijs' <==== this line
> y=. sel ndx } y
> end.
> fullname each jpath each y
> )
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm