From 925f19f6d40b1a80d717d9438e16df5f506d5fcf Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Fri, 8 Nov 2002 08:32:13 +0000
Subject: [PATCH] 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
---
docs/manual/OptionalTasks/attrib.html | 13 ++++---------
docs/manual/OptionalTasks/chgrp.html | 13 +++++--------
docs/manual/OptionalTasks/chown.html | 13 +++++--------
src/main/org/apache/tools/ant/taskdefs/Chmod.java | 3 +--
.../taskdefs/optional/unix/AbstractAccessTask.java | 10 +---------
.../tools/ant/taskdefs/optional/unix/Chown.java | 2 --
.../tools/ant/taskdefs/optional/windows/Attrib.java | 12 +++---------
7 files changed, 19 insertions(+), 47 deletions(-)
diff --git a/docs/manual/OptionalTasks/attrib.html b/docs/manual/OptionalTasks/attrib.html
index f71f93852..7eeb0f926 100644
--- a/docs/manual/OptionalTasks/attrib.html
+++ b/docs/manual/OptionalTasks/attrib.html
@@ -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.
-FileSet can be specified
+
FileSets can be specified
using nested <fileset>
elements.
Parameters
@@ -27,15 +27,10 @@ using nested <fileset>
elements.
file |
- the file of which the permissions must be
- changed. |
- one of the two or
- nested <fileset> elements. |
-
-
- dir |
- the directory whose permissions must be
+ | the file or directory of which the permissions must be
changed. |
+ Yes or nested
+ <fileset> elements. |
readonly |
diff --git a/docs/manual/OptionalTasks/chgrp.html b/docs/manual/OptionalTasks/chgrp.html
index 8e3be3043..23845e903 100644
--- a/docs/manual/OptionalTasks/chgrp.html
+++ b/docs/manual/OptionalTasks/chgrp.html
@@ -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.
-FileSet can be specified
+
FileSets can be specified
using nested <fileset>
elements.
Parameters
@@ -27,13 +27,10 @@ using nested <fileset>
elements.
file |
- the file of which the group must be changed. |
- one of the two or
- nested <fileset> elements. |
-
-
- dir |
- the directory whose group must be changed. |
+ the file or directory of which the group must be
+ changed. |
+ Yes or nested
+ <fileset> elements. |
group |
diff --git a/docs/manual/OptionalTasks/chown.html b/docs/manual/OptionalTasks/chown.html
index 84b4231a8..a7f757c46 100644
--- a/docs/manual/OptionalTasks/chown.html
+++ b/docs/manual/OptionalTasks/chown.html
@@ -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.
-FileSet can be specified
+
FileSets can be specified
using nested <fileset>
elements.
Parameters
@@ -27,13 +27,10 @@ using nested <fileset>
elements.
file |
- the file of which the owner must be changed. |
- one of the two or
- nested <fileset> elements. |
-
-
- dir |
- the directory of which the owner must be changed. |
+ the file or directory of which the owner must be
+ changed. |
+ Yes or nested
+ <fileset> elements. |
owner |
diff --git a/src/main/org/apache/tools/ant/taskdefs/Chmod.java b/src/main/org/apache/tools/ant/taskdefs/Chmod.java
index 72e4f3957..6fc776c96 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Chmod.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Chmod.java
@@ -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);
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
index cd5a9f475..056170c84 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
@@ -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);
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
index 209ade428..96ecc16f9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
@@ -65,8 +65,6 @@
package org.apache.tools.ant.taskdefs.optional.unix;
-import java.io.File;
-
import org.apache.tools.ant.BuildException;
/**
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java b/src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java
index 4df666a1d..a345ffbd8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java
@@ -67,6 +67,8 @@ import java.io.File;
*
* @author skanga@bigfoot.com
* @author Jerome Lacoste
+ *
+ * @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);
}