That's true mostly within J for Windows, but not always.

The WHEREAMI code I posted won't work unless it finds the actual
separator in use, because 4!:3'' returns paths with backslashes.

At least it does on the Win2000 that I'm using. Maybe that's a bug?


On Tue, Nov 22, 2011 at 7:23 AM, Ric Sherlock <tikk...@gmail.com> wrote:
> Yes Bob's info is correct for J6. In J7 '/' is used as the path
> separator for all systems. It is honoured on Windows as well as
> Linux/Mac. If you really want a conventionally separated path on
> Windows (for display etc) then you can use the verb: winpathsep
>
> On Tue, Nov 22, 2011 at 8:16 PM, bob therriault <bobtherria...@mac.com> wrote:
>> PATHSEP_j_ may be what you are looking for Ian. It is set at startup from 
>> the j602\bin\profile.ijs and is referenced in numerous verbs such as 
>> jhostpath_z_ and jpath_z_
>>
>> Cheers, bob
>>
>> On 2011-11-21, at 10:24 PM, Ian Clark wrote:
>>
>>> 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
>>
>> ----------------------------------------------------------------------
>> 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