Rebol Programming/path-thru

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

USAGE:[edit | edit source]

PATH-THRU url 

DESCRIPTION:[edit | edit source]

Return a path relative to the disk cache.

PATH-THRU is a function value.

ARGUMENTS:[edit | edit source]

  • url -- (Type: any)

SOURCE CODE[edit | edit source]

path-thru: func [
    "Return a path relative to the disk cache." 
    url /local purl
][
    if file? url [return url] 
    if not all [purl: decode-url url purl/host] [return none] 
    rejoin [view-root/public slash purl/host slash any [purl/path ""] any [purl/target ""]]
]