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-fileaddr1 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).
clear-pathpath-addr – gforth “clear-path”
Set the path path-addr to empty.
also-pathc-addr len path-addr – gforth “also-path”
add the directory c-addr len to path-addr.
.pathpath-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)