System/Directory Paths

From J Wiki
Jump to navigation Jump to search

Directory Foreigns

1!:43 y      Query Current Working Directory
1!:44 y      Set Current Working Directory

Folder Tables

JFE defines BINPATH_z_ as the full path to the J bin folder that contains JFE, JE, and profile.ijs.

profile.ijs, before it boots up the rest of the standard library, defines SystemFolders_j_ as a 2-column table of folder names and paths.

UserFolders_j_ is a similar table defined from the user's configuration script config.ijs. As much as possible it should be defined relative to the names in SystemFolders_j_. UserFolder names should start with an upper-case letter.

See also Folders and Projects.

Directory Verbs

The profile defines the following verbs in the z locale:

jpath       converts argument to a full path name
jcwdpath    return path in current working directory

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.


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'

  jpath '~temp\t2.ijs'

  jpath '~JPB\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'

  jpath '~..JPB\release\pbr.ijs'

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'