跳轉到內容

Rebol 程式設計/clean-path

來自華夏公益教科書
CLEAN-PATH target 

清理路徑中的“.”和“..”;返回清理後的路徑。

CLEAN-PATH 是一個函式值。

  • 目標 -- (型別:檔案 URL)

原始碼

[編輯 | 編輯原始碼]
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
]
華夏公益教科書