即使目录存在,nant directory :: exists也会返回false

Sha*_*lle 3 nant

我正在尝试检查目录是否作为NAnt脚本的一部分存在并获得误报.这是脚本片段:

<echo message="${backup.dir} --> ${directory::exists('${backup.dir}')}"/>
Run Code Online (Sandbox Code Playgroud)

这是输出:

[echo] D:\D\RTC\backup\20110223 --> False
Run Code Online (Sandbox Code Playgroud)

除了目录存在.

作为旁注,如果我跑..

<echo message="${backup.dir} --> ${directory::get-creation-time('${backup.dir}')}"/>
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Expression: ${backup.dir} --> ${directory::get-creation-time('${backup.dir}')}
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Could not find a part of the path "D:\D\RTC\${backup.dir}".
Run Code Online (Sandbox Code Playgroud)

如果我跑..

<echo message="Directory Name --> ${path::get-directory-name('${backup.dir}')}"/>
Run Code Online (Sandbox Code Playgroud)

我明白了

[echo] Directory Name -->
Run Code Online (Sandbox Code Playgroud)

总而言之,我现在很困惑..有什么想法吗?

The*_*man 7

您不得${}以嵌套方式使用:

<echo message="${backup.dir} --> ${directory::exists(backup.dir)}"/>
Run Code Online (Sandbox Code Playgroud)