REBOL Programming/in-dir

< REBOL Programming

USAGE:

IN-DIR dir block 

DESCRIPTION:

Evaluate a block while in a directory.

IN-DIR is a function value.

ARGUMENTS:

(SPECIAL ATTRIBUTES)

SOURCE CODE

in-dir: func [
    "Evaluate a block while in a directory." 
    [throw] 
    dir [file!] "Directory to change to (changed back after)" 
    block [block!] "Block to evaluate" 
    /local old-dir
][
    old-dir: what-dir 
    change-dir dir 
    also do block change-dir old-dir
]
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.