Browse Source

don't delete plain files with symlink, must have been broken by my last changes to symlink

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@693081 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
af0fb970a1
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java

+ 12
- 1
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java View File

@@ -466,11 +466,22 @@ public class Symlink extends DispatchTask {
*/
public static void deleteSymlink(File linkfil, Task task)
throws IOException {
if (!linkfil.exists()) {
if (FILE_UTILS.isDanglingSymbolicLink(linkfil.getParentFile(),
linkfil.getName())) {
linkfil.delete();
return;
}

if (!FILE_UTILS.isSymbolicLink(linkfil.getParentFile(),
linkfil.getName())) {
// plain file, not a link
return;
}

if (!linkfil.exists()) {
throw new FileNotFoundException("No such symlink: " + linkfil);
}

// find the resource of the existing link:
File canfil = linkfil.getCanonicalFile();



Loading…
Cancel
Save