Handbook
Glossary
with-directory ( path quot -- )
Factor handbook
»
Input and output
»
Directory manipulation
»
Current working directory
Prev:
set-current-directory ( path -- )
Next:
absolute-path ( path -- path' )
Vocabulary
io
.
directories
Inputs
path
a pathname string
quot
a
quotation
Outputs
None
Word description
Calls the quotation in a new dynamic scope with the
current-directory
variable rebound.
If
path
is relative, it is first resolved relative to the current directory. If
path
is absolute, it becomes the new current directory.
See also
cd
,
cwd
,
current-directory
,
set-current-directory
Definition
USING:
io.pathnames
kernel
namespaces
;
IN:
io.directories
:
with-directory
( path quot -- )
[
absolute-path
current-directory
]
dip
with-variable
;
inline