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
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to