6.20.5.1 Source Search Paths

The search path is initialized when you start Gforth (see Invoking Gforth). You can display it and change it using fpath in combination with the general path handling words.

fpath ( – path-addr  ) gforth-0.4 “fpath”
.fpath ( ) gforth-0.4 “.fpath”

Display the contents of the Forth search path.

file>fpath ( addr1 u1 – addr2 u2  ) gforth-1.0 “file>fpath”

Searches for a file with the name c-addr1 u1 in the fpath. If successful, c-addr u2 is the absolute file name or the file name relative to the current working directory. Throws an exception if the file cannot be opened.

Here is an example of using fpath and require:

fpath path= /usr/lib/forth/|./
require timer.fs