Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Rebol Programming/split-path

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

USAGE: SPLIT-PATH target DESCRIPTION: Splits a file or URL path. Returns a block containing path and target. SPLIT-PATH is a function value. ARGUMENTS target -- (Type: file url) SOURCE CODE split-path: func [ {Splits a file or URL path. Returns a block containing path and target.} target [file! url!] /local dir pos ][ parse/all target [ [#"/" | 1 2 #"." opt #"/"] end (dir: dirize target) | pos: any [thru #"/" [end | pos:]] ( all [empty? dir: copy/part target at head target index? pos dir: %./] all [find [%. %..] pos: to file! pos insert tail pos #"/"] ) ] reduce [dir pos] ]