跳轉到內容

Rebol 程式設計/do-boot

來自華夏公益教科書,開放的書籍,開放的世界
DO-BOOT target args dependent 

僅當值及其檔案(URL)及其依賴項存在時才執行值。

DO-BOOT 是一個函式值。

  • 目標 -- (型別:任何)
  • 引數 -- (型別:任何)
  • 依賴項 -- (型別:任何)

原始碼

[編輯 | 編輯原始碼]
do-boot: func [
    {Does a value only if it and its file (URL) and it's dependent exists.} 
    target 
    args 
    dependent 
    /local check dir
][
    check: func [target /local tmp] [
        if exists? target [return make file! 1] 
        if exists? system/options/home/:target [return system/options/home] 
        none
    ] 
    if target [
        if dependent [dir: check dependent] 
        if none? dir [dir: check target] 
        if dir [
            dir: append copy dir target 
            if exists? dir [do/args dir args return true]
        ]
    ] 
    false
]
華夏公益教科書