From 617c63c012e9ef8420dfa1de8d2ecdcabb67e74a Mon Sep 17 00:00:00 2001 From: Costin Manolache Date: Thu, 24 Feb 2000 01:34:45 +0000 Subject: [PATCH] - Fixed ( workaround) Deltree - didn't worked on taz or any machine with /home sym-linked. - make sure basedir is exposed as a property. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267616 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/Project.java | 1 + .../apache/tools/ant/taskdefs/Deltree.java | 28 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 0b1aa2186..a00286cb8 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -241,6 +241,7 @@ public class Project { public void setBaseDir(File baseDir) { this.baseDir = baseDir; + setProperty( "basedir", baseDir.getAbsolutePath()); String msg = "Project base dir set to: " + baseDir; log(msg, MSG_INFO); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Deltree.java b/src/main/org/apache/tools/ant/taskdefs/Deltree.java index 63df48085..03cb33f67 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Deltree.java +++ b/src/main/org/apache/tools/ant/taskdefs/Deltree.java @@ -96,19 +96,21 @@ public class Deltree extends Task { // check to make sure that the given dir isn't a symlink // the comparison of absolute path and canonical path // catches this - - if (dir.getCanonicalPath().equals(dir.getAbsolutePath())) { - String[] list = dir.list(); - for (int i = 0; i < list.length; i++) { - String s = list[i]; - File f = new File(dir, s); - if (f.isDirectory()) { - removeDir(f); - } else { - f.delete(); - } - } - } + + // if (dir.getCanonicalPath().equals(dir.getAbsolutePath())) { + // (costin) It will not work if /home/costin is symlink to /da0/home/costin ( taz + // for example ) + String[] list = dir.list(); + for (int i = 0; i < list.length; i++) { + String s = list[i]; + File f = new File(dir, s); + if (f.isDirectory()) { + removeDir(f); + } else { + f.delete(); + } + } + // } dir.delete(); } }