Browse Source

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 <holtdl@yahoo.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268138 13f79535-47bb-0310-9956-ffa450edef68
master
glennm 24 years ago
parent
commit
596d7e465f
1 changed files with 13 additions and 8 deletions
  1. +13
    -8
      src/main/org/apache/tools/ant/taskdefs/Copy.java

+ 13
- 8
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -167,13 +167,17 @@ public class Copy extends Task {

// 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 @@ public class Copy extends Task {
*/
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()) {


Loading…
Cancel
Save