when-file-exists ( ... path quot: ( ... path -- ... ) -- ... )


Vocabulary
io.files

Inputs
patha pathname string
quota quotation with stack effect ( ... path -- ... )


Outputs
None

Word description
If path is a file that exists, calls the quot quotation.

Notes
It is possible for the file to be created or deleted after the call to file-exists? but before running quot. If that is a concern, you might want to open the file for reading or writing, as needed.

See also
if-file-exists, unless-file-exists

Definition


: when-file-exists
( ... path quot: ( ... path -- ... ) -- ... )
[ drop ] if-file-exists ; inline