The following post describes how some of my thoughts on cross-version, cross-OS support of path speparators.
http://www.jsoftware.com/pipermail/beta/2010-June/004045.html On Fri, Nov 25, 2011 at 8:48 PM, Ian Clark <earthspo...@gmail.com> wrote: > PATHSEP_j_ does not exist in J7, it seems. > > Back to the drawing board. I shall revert to the first technique I > tried, shabby though it is: I'll actually look for '\' and if it's not > there I'll assume '/'. > > > > On Tue, Nov 22, 2011 at 7:16 AM, 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