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

编程入门 行业动态 更新时间:2024-10-24 18:23:00
即使目录存在,nant directory :: exists也会返回false(nant directory::exists returns false even though directory exists)

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

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

这是输出:

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

除了该目录存在。

作为一个侧面说明,如果我跑..

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

我收到以下错误:

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

如果我运行..

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

我明白了

[echo] Directory Name -->

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

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?

最满意答案

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

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

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

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

更多推荐

backup,dir,-->,电脑培训,计算机培训,IT培训"/> <meta name="description

本文发布于:2023-08-05 22:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1441123.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:也会   目录   nant   exists   directory

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!