ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r693081 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
Date Mon, 08 Sep 2008 12:44:53 GMT
Author: bodewig
Date: Mon Sep  8 05:44:52 2008
New Revision: 693081

URL: http://svn.apache.org/viewvc?rev=693081&view=rev
Log:
don't delete plain files with symlink, must have been broken by my last changes to symlink

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java?rev=693081&r1=693080&r2=693081&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java Mon Sep
 8 05:44:52 2008
@@ -466,11 +466,22 @@
      */
     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();
 



Mime
View raw message