Nant:无法从.include获取当前目录 [英] Nant: can't get current directory from .include

查看:97
本文介绍了Nant:无法从.include获取当前目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要总结一下这对我来说并不完全容易...我在磁盘上有此结构:

It's not exactly easy for me to summarize this... I have this structure on disk:

[dir]项目

  • [dir] foo
    • [file] foo.build
    • [dir] foo
      • [file] foo.build
      • [file] bar.build

      文件default.include包含几个属性,这些属性是构建期间使用的目录.例如: 属性名称="build.dir"值="$ {directory :: get-current-directory}".

      The file default.include contains a couple of properties which are the directories used during the build. E.g: property name="build.dir" value="${directory::get-current-directory}".

      foo.build和bar.build使用其相对路径包含default.include文件: include buildfile =".. \ default.include"

      The default.include file is included by foo.build and bar.build using its relative path: include buildfile="..\default.include"

      现在的问题是:当我从project \ foo dir运行foo.build时,build.dir的值错误.我需要项目",而我却得到项目\ foo".有没有办法获取.include文件所在的目录?

      Now the problem: when I run foo.build from project\foo dir, I get the wrong value for build.dir. I need "project" and I get "project\foo" instead. Is there a way to get the directory in which the .include file exists?

      我可以使用%〜dp0在批处理文件中完成此操作

      I could do this in a batch file using %~dp0

      推荐答案

      您可以使用此

      <property name="build.dir" value="${project::get-base-directory()}">
      

      ,并确保将构建输出路径设置为build.dir

      and make sure you set the build output path to be build.dir

      这篇关于Nant:无法从.include获取当前目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆