You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michael Rauh <mi...@mindmatics.de> on 2002/08/19 11:14:09 UTC

Problem with pathconvert and map, perhaps a bug

If i use this code the pathconvert doesn´t work,

	<fileset dir="${resin.home}/webapps/${newbuild.dir}" id="jsp-path">
	  <patternset>
	    <include name="**/*.jsp"/>
	  </patternset>
	</fileset>
	<pathconvert pathsep=" " property="resin.http-path" refid="jsp-path">
	  <map from="${resin.home}/webapps/" to="http://localhost/"/>
	</pathconvert>
	 <exec executable="${resin.home}/bin/httpd.exe"
dir="${resin.home}/webapps">
	   <arg value="-compile ${resin.http-path}"/>
	 </exec>

but if i change:

	  <map from="${resin.home}/webapps/" to="http://localhost/"/>
to
	  <map from="D:/tools/resin/resin-2.0.5/webapps/" to="http://localhost/"/>

it just works  fine.

But I can`t figure out why?

Can anyone help me please.


Best regards


Michael



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Problem with pathconvert and map, perhaps a bug

Posted by Diane Holt <ho...@yahoo.com>.
--- Michael Rauh <mi...@mindmatics.de> wrote:
> If i use this code the pathconvert doesn�t work,
> <fileset dir="${resin.home}/webapps/${newbuild.dir}" id="jsp-path">
>   <patternset>
>     <include name="**/*.jsp"/>
>   </patternset>
>  </fileset>
>  <pathconvert pathsep=" " property="resin.http-path" refid="jsp-path">
>    <map from="${resin.home}/webapps/" to="http://localhost/"/>
>  </pathconvert>
> [...]	 
> but if i change:
> <map from="${resin.home}/webapps/" to="http://localhost/"/>
> to
> <map from="D:/tools/resin/resin-2.0.5/webapps/" to="http://localhost/"/>
> 
> it just works  fine.
> 
> But I can`t figure out why?

Because the set of files generated by <fileset> are fully resolved paths,
including the drive letter -- but apparently, that's not true for how you
set the value of ${resin.home}. You can see this by (temporarily) taking
out the <map> element and simply <echo>'ing out ${resin.http-path}.

For example, if I have:
  <target name="showfs">
    <property name="temp.dir" value="sub"/>
    <fileset id="fs" dir="${temp.dir}" includes="*.txt"/>
    <pathconvert pathsep="${line.separator}" property="fs" refid="fs"/>
    <echo>${fs}</echo>
  </target>

Running it gives me:
showfs:
     [echo] D:\cygwin\home\dianeh\work\ant\TEMP\sub\bar.txt
     [echo] D:\cygwin\home\dianeh\work\ant\TEMP\sub\foo.txt

If I wanted to "map off" ${temp.dir}, I'd need to do it with:
      <map from="${basedir}${file.separator}${temp.dir}${file.separator}"
           to=""/>

which would give me just the two file names. Note that if I <map> from
${temp.dir}, however, the end result would be exactly as it is without any
<map> at all, because it wouldn't match, since the value of ${temp.dir} is
simply "sub".

However, if I set temp.dir using the 'location' attribute:
    <property name="temp.dir" location="sub"/>

then I could reference ${temp.dir} in my <map>:
    <pathconvert pathsep="${line.separator}" property="fs" refid="fs">
      <map from="${temp.dir}${file.separator}" to=""/>
    </pathconvert>

and that will give me just the same results as mapping with the fully
qualified "${basedir}..." does.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>