Browse Source

Simplify a few methods by using FileSet#setFile, remove redundant dir

attribute from the three latest task additions.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273512 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
925f19f6d4
7 changed files with 19 additions and 47 deletions
  1. +4
    -9
      docs/manual/OptionalTasks/attrib.html
  2. +5
    -8
      docs/manual/OptionalTasks/chgrp.html
  3. +5
    -8
      docs/manual/OptionalTasks/chown.html
  4. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/Chmod.java
  5. +1
    -9
      src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
  6. +0
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
  7. +3
    -9
      src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java

+ 4
- 9
docs/manual/OptionalTasks/attrib.html View File

@@ -15,7 +15,7 @@ directories. Right now it has effect only under Windows. Each of the
4 possible permissions has its own attribute, matching the arguments
for the attrib command.</p>

<p><a href="../CoreTypes/fileset.html">FileSet</a> can be specified
<p><a href="../CoreTypes/fileset.html">FileSet</a>s can be specified
using nested <code>&lt;fileset&gt;</code> elements.</p>

<h3>Parameters</h3>
@@ -27,15 +27,10 @@ using nested <code>&lt;fileset&gt;</code> elements.</p>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">the file of which the permissions must be
changed.</td>
<td valign="top" valign="middle" rowspan="2">one of the two or
nested <code>&lt;fileset&gt;</code> elements.</td>
</tr>
<tr>
<td valign="top">dir</td>
<td valign="top">the directory whose permissions must be
<td valign="top">the file or directory of which the permissions must be
changed.</td>
<td valign="top" valign="middle">Yes or nested
<code>&lt;fileset&gt;</code> elements.</td>
</tr>
<tr>
<td valign="top">readonly</td>


+ 5
- 8
docs/manual/OptionalTasks/chgrp.html View File

@@ -15,7 +15,7 @@ directories. Right now it has effect only under Unix. The group
atribute is equivalent to the coresponding argument for the chgrp
command.</p>

<p><a href="../CoreTypes/fileset.html">FileSet</a> can be specified
<p><a href="../CoreTypes/fileset.html">FileSet</a>s can be specified
using nested <code>&lt;fileset&gt;</code> elements.</p>

<h3>Parameters</h3>
@@ -27,13 +27,10 @@ using nested <code>&lt;fileset&gt;</code> elements.</p>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">the file of which the group must be changed.</td>
<td valign="top" valign="middle" rowspan="2">one of the two or
nested <code>&lt;fileset&gt;</code> elements.</td>
</tr>
<tr>
<td valign="top">dir</td>
<td valign="top">the directory whose group must be changed.</td>
<td valign="top">the file or directory of which the group must be
changed.</td>
<td valign="top" valign="middle">Yes or nested
<code>&lt;fileset&gt;</code> elements.</td>
</tr>
<tr>
<td valign="top">group</td>


+ 5
- 8
docs/manual/OptionalTasks/chown.html View File

@@ -15,7 +15,7 @@ directories. Right now it has effect only under Unix. The owner
atribute is equivalent to the coresponding argument for the chown
command.</p>

<p><a href="../CoreTypes/fileset.html">FileSet</a> can be specified
<p><a href="../CoreTypes/fileset.html">FileSet</a>s can be specified
using nested <code>&lt;fileset&gt;</code> elements.</p>

<h3>Parameters</h3>
@@ -27,13 +27,10 @@ using nested <code>&lt;fileset&gt;</code> elements.</p>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">the file of which the owner must be changed.</td>
<td valign="top" valign="middle" rowspan="2">one of the two or
nested <code>&lt;fileset&gt;</code> elements.</td>
</tr>
<tr>
<td valign="top">dir</td>
<td valign="top">the directory of which the owner must be changed.</td>
<td valign="top">the file or directory of which the owner must be
changed.</td>
<td valign="top" valign="middle">Yes or nested
<code>&lt;fileset&gt;</code> elements.</td>
</tr>
<tr>
<td valign="top">owner</td>


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/Chmod.java View File

@@ -106,8 +106,7 @@ public class Chmod extends ExecuteOn {
*/
public void setFile(File src) {
FileSet fs = new FileSet();
fs.setDir(new File(src.getParent()));
fs.createInclude().setName(src.getName());
fs.setFile(src);
addFileset(fs);
}



+ 1
- 9
src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java View File

@@ -93,15 +93,7 @@ public abstract class AbstractAccessTask

public void setFile(File src) {
FileSet fs = new FileSet();
fs.setDir(new File(src.getParent()));
fs.createInclude().setName(src.getName());
addFileset(fs);
}

public void setDir(File src) {
FileSet fs = new FileSet();
fs.setDir(new File(src.getParent()));
fs.createInclude().setName(src.getName());
fs.setFile(src);
addFileset(fs);
}



+ 0
- 2
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java View File

@@ -65,8 +65,6 @@

package org.apache.tools.ant.taskdefs.optional.unix;

import java.io.File;

import org.apache.tools.ant.BuildException;

/**


+ 3
- 9
src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java View File

@@ -67,6 +67,8 @@ import java.io.File;
*
* @author skanga@bigfoot.com
* @author <a href="mailto:Jerome@jeromelacoste.com">Jerome Lacoste</a>
*
* @since Ant 1.6
*/
public class Attrib extends ExecuteOn {

@@ -86,15 +88,7 @@ public class Attrib extends ExecuteOn {

public void setFile(File src) {
FileSet fs = new FileSet();
fs.setDir(new File(src.getParent()));
fs.createInclude().setName(src.getName());
addFileset(fs);
}

public void setDir(File src) {
FileSet fs = new FileSet();
fs.setDir(new File(src.getParent()));
fs.createInclude().setName(src.getName());
fs.setFile(src);
addFileset(fs);
}



Loading…
Cancel
Save