Rebol Programming/clean-path

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

USAGE:[edit | edit source]

CLEAN-PATH target 

DESCRIPTION:[edit | edit source]

Cleans-up '.' and '..' in path; returns the cleaned path.

CLEAN-PATH is a function value.

ARGUMENTS[edit | edit source]

  • target -- (Type: file url)

SOURCE CODE[edit | edit source]

clean-path: func [
    {Cleans-up '.' and '..' in path; returns the cleaned path.} 
    target [file! url!]
    if url? target [return target] 
    if find [%/ %/. %/..] target [return %/] 
    get-modes target 'full-path