开发者

nant directory::exists returns false even though directory exists

开发者 https://www.devze.com 2023-02-12 19:47 出处:网络
I\'m trying to check for if a directory exists as part of a NAnt script and getting a false negative.Here is开发者_运维知识库 the script fragment:

I'm trying to check for if a directory exists as part of a NAnt script and getting a false negative. Here is开发者_运维知识库 the script fragment:

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

Here is the output:

[echo] D:\D\RTC\backup\20110223 --> False

Except the directory exists.

As a side note if I run..

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

I get the following error:

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

AND if I run..

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

I get

[echo] Directory Name -->

All in all I'm very confused right now.. Any thoughts?


You must not use ${} in a nested way:

<echo message="${backup.dir} --> ${directory::exists(backup.dir)}"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消