[REBOL] Re: CPAN for REBOL
From: jeff:rebol at: 4-Mar-2001 11:47
Howdy, Bob:
Hey! I would have helped, but now that you're throwing my
scripts in the bargain-basement and deleting them and
all... zoinks -- what a meanie! ;)
> An additional requirement would be that the owner of the
> cache be allowed to set which dirs were used to store which
> domains/subpaths
>
> cache/setup/location-for "jeff/somesubd"
> %tmp/bargain-basement-scripts/jeff/
>
> so that if the owner of the local machine pleased, they
> could remove all the files in a certain directory and only
> affect a specific (knowable) portion of the cache.
Read-thru and Load-thru in VIEW are good starting places as
they use the public sandbox as a cache. They could be
enhanced / wrapped. System/user/home/%public/, in REBOL's
default security setting, is a world read/writable sandbox for
scripts to work in. Load-thru calls read-thru. -jeff
>> source read-thru
read-thru: func [
{Read a file from the net thru the public cache. Failure
returns error.}
url [url! file!]
/update "Force update from source site"
/local path file data
][
if file? url [return read url]
path: parse url "/"
file: last path
path: rejoin [system/options/home %public/ path/3 "/"]
if not exists? path [make-dir/deep path]
either all [not update exists? path/:file] [read/binary path/:file] [
data: read/binary url
write/binary path/:file data
data
]
]