実行時
do-file: func[file][
if error? error: try [
if (find [%.r %.cgi] (suffix? file)) [
do file
]
][
disarm error
print ["error executing " file]
input
]
]
foreach-file: func [
"Perform function on each file in selected directory recursively"
dir [file! url!] "Directory to look in"
act [function!] "Function to perform (filename is unput to function)"
/directory "Perform function also on directories"
/local f files
][
if not equal? last dir #"/" [
dir: to-rebol-file join dir #"/"
]
files: attempt [read dir]
either none? files [return][
foreach file files [
f: join dir file
either dir? f [
either directory [
act f
foreach-file/directory f :act
][
foreach-file f :act
]
][act f]
]
]
]
feach-file %test/ :do-file
%test には、rebo ヘッダーのみのファイルが含まれます。
rebol []
プログラムは、エラーを解除する代わりに、エラーで停止します!
ファイルに次のようなものが含まれている場合、エラーは発生しません
rebol []
test: context []
しかし、それが含まれていると再び失敗します
rebol []
print ""
なんで ?