Expanding Variables in if statements

Michael Corr <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
hi
I'm trying to check if a source string contains a substring, inside an <if>
statement, but it doesn't seem to work when the source string is a variable

I have:
    <property name="dir.base" value="this/is/my/working/directory" />
    <if test="${string::contains('${dir.base}','working')}">
      <echo>This is my directory</echo>
    </if>

This never returns true. It doesn't seem to parse the ${dir.base} variable
inside the <if> statement

If I change the test to:
    <if test="${string::contains('${dir.base}','base')}">
      <echo>This is my directory</echo>
    </if>

This does return true. So, it appears to treat the variable as a literal and
not a variable.

Am I missing something? I tried removing the single quotes around
${dir.base} and got an error about the $ character. I also tried using
double quotes, but got an error as well

Is there a better way to check if a string (or path) contains a specific
directory?

thanks
Michael

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.