Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ant Wiki" for change 
notification.

The following page has been changed by GeorgeBerger:
http://wiki.apache.org/ant/AntSampleFiles/ApplyRedirectorExample

------------------------------------------------------------------------------
- Redirector example: copies files by using the apply task to execute 'cat' 
with input redirected from source file src/*.src and output redirected to 
dest/*.out.
+ Redirector example: copies files by using the apply task to execute `cat` 
with input redirected from source file src/*.src and output redirected to 
dest/*.out.
  
  {{{
  <project default="copycat">
@@ -9, +9 @@

       <apply executable="cat" addsourcefile="false">
         <redirector>
           <outputmapper>
-            <mapper type="glob" from="*.src" 
+            <mapper type="glob" from="*.src"
-                to="dest${file.separator}*.out" />
+                    to="dest${file.separator}*.out" />
           </outputmapper>
           <inputmapper>
-            <mapper type="glob" from="*" to="src${file.separator}*"/>
+            <mapper type="glob" from="*"
+                    to="src${file.separator}*"/>
           </inputmapper>
         </redirector>
         <fileset dir="src" includes="*.src" />
@@ -35, +36 @@

  
  The mapper used by inputmapper just maps each source file '*' to the file 
with the same name in the src directory, 'src/*'.  This is essentially an 
identity mapping, but the files passed to the mapper consist of just the 
filename, so the directory name needs to be prepended to pick up the right file.
  
- By default, the apply task passes the source file name as a command line 
argument to its executable for each execution.  We need to inhibit this 
behavior for this example by setting the addsourcefile attribute false, so that 
cat will take input from the input redirect instead of reading the named file.  
(The result would be the same in this case, but we're trying to demonstrate 
input redirect.)
+ By default, the apply task passes the source file name as a command line 
argument to its executable for each execution.  We need to inhibit this 
behavior for this example by setting the addsourcefile attribute false, so that 
`cat` will take input from the input redirect instead of reading the named 
file.  (The result would be the same in this case, but we're trying to 
demonstrate input redirect.)
  

Reply via email to