Directory Paths in J

Directory Foreigns

1!:43 yQuery Current Working Directory
1!:44 ySet Current Working Directory
1!:45 yQuery Default Profile

See J Help on !: (foreign conjunctions) for further details.

Folder Tables

The J profile defines the following two folder tables in the j locale:

SYSTEMFOLDERS_j_ is a 2-column table of folder names and paths. This table is required by the system scripts. If you need to modify the paths (second column) in this table, change the profile script used on start up. You should not modify the entries in the first column. For example:

+-------+-----------------+
|system |c:\j5\system     |
+-------+-----------------+
|profile|c:\j5            |
+-------+-----------------+
|home   |c:\j5            |
+-------+-----------------+
|temp   |c:\j5\temp       |
+-------+-----------------+
|addons |c:\jx\addons     |
+-------+-----------------+
|user   |c:\jx\user       |
+-------+-----------------+
|config |c:\jx\user\config|
+-------+-----------------+
Here:

systemsystem directory
profileprofile directory (i.e. file profile.ijs)
homeHOME in UNIX, otherwise same as profile
temptemporary directory
addonsaddons directory
useruser directory
configuser configuration directory

USERFOLDERS_j_ has the same form, and is defined from the user's configuration script, config.ijs, and read in by the standard profile. This table is referenced by Find in Files, and Project Manager. You can modify this table as you wish. For example:

+------+-----------------+
|LTsrc |c:\lt\source     |
+------+-----------------+
|LTrel |c:\lt\release    |
+------+-----------------+
|JPB   |d:\jss\jpb\source|
+------+-----------------+
|JST   |d:\jst\source    |
+------+-----------------+
|JSTdev|d:\jst\dev       |
+------+-----------------+
...

Note that some paths in the default USERFOLDERS table are the same as in the SYSTEMFOLDERS table. This is intentional, nevertheless you are free to remove or modify such entries in USERFOLDERS. To avoid conflicts between the folder names (first column) in the two tables, we suggest that you use an initial capital letter in the folder names of USERFOLDERS, since folder names in SYSTEMFOLDERS are all lowercase.

Directory Verbs

The profile defines the following verbs in the z locale:

jpathconverts argument to a full path name
jcwdpathreturn current working directory
jhostpathconvert separators in filename to host operating system

These verbs are used to provide the full pathname for files, and to ensure that the path separator is correct for the host operating system. For example:

   jpath '~system\main\dates.ijs'
c:\j5\system\main\dates.ijs

   jhostpath 'system\main/dates.ijs'    NB. in Windows
system\main\dates.ijs

   jcwdpath ''
c:\j5

   jcwdpath 'system\main'
C:\j5\system\main

jpath

Verb jpath references the folder tables. It converts strings with folder names preceded with ~, for example ~mywork. The folder name is read up to the first path separator (/\) or the end, for example:
  jpath '~temp'
c:\j5\temp

  jpath '~temp\t2.ijs'
c:\j5\temp\t2.ijs

  jpath '~JPB\classes\board\init.ijs'
d:\jss\jpb\source\classes\board\init.ijs
Where the folder name is preceded with ~., for example ~.mywork, this refers to the corresponding parent directory, for example:
  jpath '~.JPB\dev\regtest.ijs'
d:\jss\jpb\dev\regtest.ijs

  jpath '~..JPB\release\pbr.ijs'
d:\jss\release\pbr.ijs
Verb jpath also converts path separators to the current path separator, and so can be used instead of jhostpath (which is still supported).

Verbs load, require and script call jpath, and so recognize ~path names, e.g.
  load '~JPB\classes\board\init.ijs'
  require '~user\projects\run\run.ijs'

Project Manager

Project Manager stores names in ~path form, when files are added to the project. This means that developers working on the same project can use different directories, as long as they have made appropriate folder definitions.

The conversion process:

Existing names in a project are not converted. Therefore you can edit the project file to replace any ~path name with a full filename, and this will be preserved.

Earlier versions of Project Manager stored some names as a relative path name, starting from the J executable directory. Such names are converted to ~path form.

The Look In combobox in Project Manager displays entries in USERFOLDERS, except those pointing to the J system directory. The reason for the exclusion is that projects should not be developed in the J system directory.


>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  User >>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  User