From f400b0cf338360c34fcd87f54cfeee60fc00158f Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Mon, 28 Feb 2000 02:17:57 +0000 Subject: [PATCH] First installment on \x/ill Uther's changes. While some (like chmod) are clearly Mac motivated, others (like Javac) are fixes to bugs that can appear on any platform. Submitted by: William Uther git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267621 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Chmod.java | 3 ++- src/main/org/apache/tools/ant/taskdefs/Delete.java | 10 +++++++--- src/main/org/apache/tools/ant/taskdefs/Javac.java | 6 +++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Chmod.java b/src/main/org/apache/tools/ant/taskdefs/Chmod.java index 2de2f1895..d092b4e03 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Chmod.java +++ b/src/main/org/apache/tools/ant/taskdefs/Chmod.java @@ -81,7 +81,8 @@ public class Chmod extends Task { public void execute() throws BuildException { try { // XXX if OS=unix - if (System.getProperty("path.separator").equals(":")) + if (System.getProperty("path.separator").equals(":") && + !System.getProperty("os.name").startsWith("Mac")) Runtime.getRuntime().exec("chmod " + mod + " " + srcFile ); } catch (IOException ioe) { // ignore, but warn diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java index ed42136af..76a653d84 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -72,10 +72,14 @@ public class Delete extends Task { } public void execute() throws BuildException { - project.log("Deleting: " + f.getAbsolutePath()); - if (f.exists()) { - f.delete(); + if (f.isDirectory()) { + project.log("Directory: " + f.getAbsolutePath() + + " cannot be removed with delete. Use Deltree instead."); + } else { + project.log("Deleting: " + f.getAbsolutePath()); + f.delete(); + } } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 2cb747fdc..9568f45fb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -248,11 +248,15 @@ public class Javac extends MatchingTask { /** * Scans the directory looking for source files to be compiled and - * support files to be copied. + * support files to be copied. The results are returned in the + * class variables compileList and filecopyList. */ private void scanDir(File srcDir, File destDir, String files[]) { + compileList.removeAllElements(); + filecopyList.clear(); + long now = (new Date()).getTime(); for (int i = 0; i < files.length; i++) {