[REBOL] enhancement to path-thru - directories
From: anton::lexicon::net at: 20-May-2002 18:42
I reckon it would be better if path-thru could
handle directories as well. I keep coming up against this.
; patch to path-thru, also returns directories
path-thru: func [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 ""]]
]
So, instead of returning none for directories, you get:
>> path-thru http://rebol.com
== %/d/anton/dev/rebol/view/public/rebol.com/
>> path-thru http://rebol.com/
== %/d/anton/dev/rebol/view/public/rebol.com/
>> path-thru http://rebol.com/afile
== %/d/anton/dev/rebol/view/public/rebol.com/afile ; <- as usual
>> path-thru http://rebol.com/adir/
== %/d/anton/dev/rebol/view/public/rebol.com/adir/
Regards,
Anton.