Well, I am disappointed by the lack of a PATH variable approach in J. (And if Raul says it, I believe it ;) )
The bigger problem is that I want to share scripts and not have them depend on being in a certain location in the filesystem. So I want to push the location of the dependencies to a single place and do all my magic there. It might be there are all sorts of good ways to solve this, but a PATH variable approach seems very common outside of J, so I went to it first mentally. Tx! -----Original Message----- From: [email protected] on behalf of Raul Miller Sent: Sun 4/18/2010 7:08 AM To: Programming forum Subject: Re: [Jprogramming] Setting the path in J? On Sat, Apr 17, 2010 at 8:20 PM, Sprague, Webb (OFM) <[email protected]> wrote: > Thanks for the answer, but it isn't quite what I am after -- I am hoping to > set the *search path* for files which are loaded or required by a script. > > In a shell script, I would do this: > > PATH="/my/special/path:$PATH" I am pretty sure that J does not have a PATH in the sense you are asking for. If you look at the source code for open: open open_j_ open_j_ 3 :0 f=. ,getscripts y ... And if you start walking through what happens at each step getscripts_j_ 'strings' ... getscripts_j_ ... jpath each <'strings' fullname_j_ jpath 'strings' ... jcwdpath 'strings' jcwdpath looks like the workhorse function here, and it's concept of a "path" looks like a "pathname" which is to say the path followed through the file system to find the file. But it's just one location (and 1!:43 gives the current working directory, and jhostpath looks like it might have a system specific definition to deal with ambiguities in the characters used to separate directories -- but I think this is not needed in windows, since windows is supposed to treat '/' and '\' the same way at the file system interface level -- its only the command line level that distinguishes between them). Anyways... perhaps it is time to take a step back and ask: why do you need this? If we focus on the problem you are trying to solve, perhaps some better alternatives will suggest themselves. Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
