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-0.4 “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-path( path-addr – ) gforth-0.5 “clear-path”
Set the path path-addr to empty.
also-path( c-addr len path-addr – ) gforth-0.4 “also-path”
add the directory c-addr len to path-addr.
.path( path-addr – ) gforth-0.4 “.path”
Display the contents of the search path path-addr.
path+( path-addr "dir" – ) gforth-0.4 “path+”
Add the directory dir to the search path path-addr.
path=( path-addr "dir1|dir2|dir3" ) gforth-0.4 “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)