Previous: Source Search Paths, Up: Search Paths General Search Paths

Your application may need to search files in several directories, like included does. To facilitate this, Gforth allows you to define and use your own search paths, by providing generic equivalents of the Forth search path words:

open-path-file       addr1 u1 path-addr – wfileid addr2 u2 0 | ior         gforth       “open-path-file”

Look in path path-addr for the file specified by addr1 u1. If found, the resulting path and and (read-only) open file descriptor are returned. If the file is not found, ior is what came back from the last attempt at opening the file (in the current implementation).

path-allot       umax –         gforth       “path-allot”

Allot a path with umax characters capacity, initially empty.

clear-path       path-addr –         gforth       “clear-path”

Set the path path-addr to empty.

also-path       c-addr len path-addr –         gforth       “also-path”

add the directory c-addr len to path-addr.

.path       path-addr –         gforth       “.path”

Display the contents of the search path path-addr.

path+       path-addr  "dir" –         gforth       “path+”

Add the directory dir to the search path path-addr.

path=       path-addr "dir1|dir2|dir3"         gforth       “path=”

Make a complete new search path; the path separator is |.

Here's an example of creating an empty search path:

     create mypath 500 path-allot \ maximum length 500 chars (is checked)