MYDIR =: getpath_j_ '\/' rplc~ > (4!:4<'thisfile'){(4!:3) thisfile=:'' NB. 
boilerplate to set the working directory



    On Tuesday, April 9, 2019, 7:11:01 p.m. EDT, Ian Clark 
<earthspo...@gmail.com> wrote:  
 
 @Bill - tried that first.

The trouble is, if the script has been loaded already, the last line of
4!:3'' is a different script.

On Tue, 9 Apr 2019 at 13:49, bill lam <bbill....@gmail.com> wrote:

> Does this work?
>
> MYSCRIPT=: >{:4!:3''
>
> On Tue, Apr 9, 2019, 8:29 PM Ian Clark <earthspo...@gmail.com> wrote:
>
> > How can I *reliably* fetch the path of the script being loaded, whilst it
> > is being loaded?
> >
> > Everything I've tried either fails or fingers the wrong script on
> > occasions. Especially if my script is the subject of "load" or "require"
> by
> > another script.
> >
> > I want to be able to write at the top of my script, say
> >
> > cocurrent 'myloc'
> > MYSCRIPT=: theScriptCurrentlyBeingLoaded''
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm  
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to