Browse Source

- 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
master
Costin Manolache 25 years ago
parent
commit
617c63c012
2 changed files with 16 additions and 13 deletions
  1. +1
    -0
      src/main/org/apache/tools/ant/Project.java
  2. +15
    -13
      src/main/org/apache/tools/ant/taskdefs/Deltree.java

+ 1
- 0
src/main/org/apache/tools/ant/Project.java View File

@@ -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);
}


+ 15
- 13
src/main/org/apache/tools/ant/taskdefs/Deltree.java View File

@@ -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();
}
}


Loading…
Cancel
Save