Current working directory
Factor handbook » Input and output » Directory manipulation

Prev:home ( -- dir )
Next:Directory listing


File system I/O operations use the value of a variable to resolve relative pathnames:
current-directory


This variable can be changed with a pair of words:
set-current-directory ( path -- )

with-directory ( path quot -- )


This variable is independent of the operating system notion of “current working directory”. While all Factor I/O operations use the variable and not the operating system's value, care must be taken when making FFI calls which expect a pathname. The first option is to resolve relative paths:
absolute-path ( path -- path' )


The second is to change the working directory of the current process:
cd ( path -- )

cwd ( -- path )