When executing
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 fuction)"
/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
where %test would contain a file with just rebo header:
rebol []
The program stops with an error instead of disarming the error !
It doesn't give an error if the file contains something like
rebol []
test: context []
but it would fail again if it contains
rebol []
print ""
Why ?