REBOL Programming/in-dir

USAGE:Edit

IN-DIR dir block 

DESCRIPTION:Edit

Evaluate a block while in a directory.

IN-DIR is a function value.

ARGUMENTS:Edit

  • dir -- Directory to change to (changed back after) (Type: file)
  • block -- Block to evaluate (Type: block)

(SPECIAL ATTRIBUTES)Edit

  • throw

SOURCE CODEEdit

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
]
Last modified on 30 October 2012, at 11:28