If I understand you correctly, you want the path without the filename.
get-buildfile-path() returns the path and file of the currently running
build script.

If all you need is the path portion, you could just parse that out
yourself:

<!-- get the full path + build file -->
                <property name="_full_path"
value="${project::get-buildfile-path()}" />
                <!-- find the index of the last '\' -->
                <property name="_index"
value="${string::last-index-of(_full_path, '\')}" />
                <!-- return a string containing the path up to
len(_index) -->
                <property name="_path"
value="${string::substring(_full_path, 0, _index)}" />

For example, my build file is C:\RelEng\Scripts\default.build

Running this returns C:\RelEng\Scripts

I am not sure if this helps or not, I may have misunderstood what you
are looking to accomplish.

Thanks,
Mike

-----Original Message-----
From: jnewton [mailto:jonathan.new...@ni.com] 
Sent: Tuesday, August 18, 2009 10:03 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Getting the Path of an Included Build File


I would like to create a common include file that several of my builds
use.
It would setup a few global directorise and properties. Then my build
files
would just use the <include> element. However, I am trying to use the
project::get-buildfile-path() function inside my include file to get the
current path of that include file. This property will then be used to
build
up other paths. 

The problem is that this function returns the path to the build file
including the include file. Since this method doesn't work, is there a
better approach? Another function I should use? 

Thanks
-- 
View this message in context:
http://www.nabble.com/Getting-the-Path-of-an-Included-Build-File-tp25025
552p25025552.html
Sent from the NAnt - Users mailing list archive at Nabble.com.


------------------------------------------------------------------------
------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008
30-Day 
trial. Simplify your report design, integration and deployment - and
focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to