You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by gl...@locus.apache.org on 2000/11/01 15:58:31 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Copy.java
glennm 00/11/01 06:58:21
Modified: src/main/org/apache/tools/ant/taskdefs Copy.java
Log:
Added error message if a single file specified by the file attribute is missing.
Also fixed up the message indicating how many files are being copied to
correctly use "file" and "files".
Reported by: Diane Holt <ho...@yahoo.com>
Revision Changes Path
1.6 +13 -8 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java
Index: Copy.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Copy.java 2000/10/13 09:43:47 1.5
+++ Copy.java 2000/11/01 14:58:08 1.6
@@ -167,13 +167,17 @@
// deal with the single file
if (file != null) {
- if (destFile == null) {
- destFile = new File(destDir, file.getName());
- }
+ if (file.exists()) {
+ if (destFile == null) {
+ destFile = new File(destDir, file.getName());
+ }
- if (forceOverwrite ||
- (file.lastModified() > destFile.lastModified())) {
- fileCopyMap.put(file.getAbsolutePath(), destFile.getAbsolutePath());
+ if (forceOverwrite ||
+ (file.lastModified() > destFile.lastModified())) {
+ fileCopyMap.put(file.getAbsolutePath(), destFile.getAbsolutePath());
+ }
+ } else {
+ log("Could not find file " + file.getAbsolutePath() + " to copy.");
}
}
@@ -279,8 +283,9 @@
*/
protected void doFileOperations() {
if (fileCopyMap.size() > 0) {
- log("Copying " + fileCopyMap.size() + " files to " +
- destDir.getAbsolutePath() );
+ log("Copying " + fileCopyMap.size() +
+ " file" + (fileCopyMap.size() == 1 ? "" : "s") +
+ " to " + destDir.getAbsolutePath() );
Enumeration e = fileCopyMap.keys();
while (e.hasMoreElements()) {