这是输出: [echo-6ren">
gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 06:17:28 25 4
gpt4 key购买 nike

我正在尝试检查一个目录是否作为 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 -->

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

最佳答案

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

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

关于即使目录存在,nant directory::exists 也会返回 false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5096762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com