If you specify an absolute filename (i.e., a filename starting with
`/' or `~', or with `:' in the second position (as in
included and friends, that file is included
just as you would expect.
For relative filenames, Gforth uses a search path similar to Forth's search order (see section Wordlists). It tries to find the given filename in the directories present in the path, and includes the first one it finds.
If the search path contains the directory `.' (as it should), this
refers to the directory that the present file was
from. This allows files to include other files relative to their own
position (irrespective of the current working directory or the absolute
position). This feature is essential for libraries consisting of
several files, where a file may include other files from the library.
It corresponds to
#include "..." in C. If the current input
source is not a file, `.' refers to the directory of the innermost
file being included, or, if there is no file being included, to the
current working directory.
Use `~+' to refer to the current working directory (as in the
If the filename starts with `./', the search path is not searched (just as with absolute filenames), and the `.' has the same meaning as described above.
Go to the first, previous, next, last section, table of contents.