Rebol Programming/do-thru

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

DO-THRU url /args arg /update /check info /boot 

DESCRIPTION:[edit | edit source]

Do a net file from the disk cache.

DO-THRU is a function value.

ARGUMENTS[edit | edit source]

  • url -- (Type: url file)

REFINEMENTS[edit | edit source]

  • /args
    • arg -- (Type: any)
  • /update -- Force update from source site
  • /check -- Update only if version, checksum/secure, or date/size do not match.
    • info -- (Type: any)
  • /boot -- Run as boot script (sets system/options/path)

SOURCE CODE[edit | edit source]

do-thru: func [
    "Do a net file from the disk cache." 
    url [url! file!] 
    /args arg 
    /update "Force update from source site" 
    /check {Update only if version, checksum/secure, or date/size do not match.} info 
    /boot "Run as boot script (sets system/options/path)" 
    /local data
][
    if not data: either update [
        read-thru/update/expand url
    ] [
        read-thru/check/expand url info
    ] [
        alert reform ["Cannot run" url] 
        return none
    ] 
    url: path-thru url 
    if boot [system/options/path: first split-path url] 
    do/args url arg
]