Does J (all versions, maybe stripped-down) maintain a dependable noun
in _z_ or _j_ giving the file path separator, viz '/' or '\' ?

Or should I always simply use? --
   IFWIN{'/\'

Does anyone know of a J-supported platform that uses anything other
than '/' or '\' ? (The Mac used to use ':' but now accepts Unix's '/'
pretty well everywhere.)

And does IFWINCE imply IFWIN?

I'm using tricks all over the place that empirically work -- but
what's the set-in-stone convention for a widely-distributed utility?

Here's the technique I propose to standardize on, for any utility
script which needs to know where it resides:

MYPATH=: 3 : 0 ''
        NB. returns directory containing this script
        NB. also assigns two globals:
        NB.   WHEREAMI  -the folder in question
        NB.   SEP       -the platform-dependent separator
ws=. [: 'Not from script'"_`({ 4!:3@(0&$))@.(0&<:) [: 4!:4 [: < >
WHEREAMI=: '<UNSET>'    NB. needed for ws to work with
z=. >ws 'WHEREAMI'
SEP=: '/\' {~ '\' e. z  NB. '\' present--> MSWin path conventions
WHEREAMI=: (>: z i: SEP) {.z
)

Any comments on its generality, style, redundancy, potential to break, etc?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to