to exists git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267717 13f79535-47bb-0310-9956-ffa450edef68master
@@ -123,8 +123,7 @@ public class Delete extends MatchingTask { | |||||
} | } | ||||
else { | else { | ||||
project.log("Deleting: " + f.getAbsolutePath()); | project.log("Deleting: " + f.getAbsolutePath()); | ||||
f.delete(); | |||||
if (f.exists()) { | |||||
if (!f.delete()) { | |||||
throw new BuildException("Unable to delete file " + f.getAbsolutePath()); | throw new BuildException("Unable to delete file " + f.getAbsolutePath()); | ||||
} | } | ||||
} | } | ||||
@@ -148,8 +147,7 @@ public class Delete extends MatchingTask { | |||||
if (f.exists()) { | if (f.exists()) { | ||||
project.log("Deleting: " + f.getAbsolutePath(), verbosity); | project.log("Deleting: " + f.getAbsolutePath(), verbosity); | ||||
f.delete(); | |||||
if (f.exists()) { | |||||
if (!f.delete()) { | |||||
throw new BuildException("Unable to delete " + f.getAbsolutePath()); | throw new BuildException("Unable to delete " + f.getAbsolutePath()); | ||||
} | } | ||||
} | } | ||||
@@ -76,8 +76,7 @@ public class Deltree extends Task { | |||||
if (dir.exists()) { | if (dir.exists()) { | ||||
if (!dir.isDirectory()) { | if (!dir.isDirectory()) { | ||||
dir.delete(); | |||||
if (dir.exists()) { | |||||
if (!dir.delete()) { | |||||
throw new BuildException("Unable to delete file " + dir.getAbsolutePath()); | throw new BuildException("Unable to delete file " + dir.getAbsolutePath()); | ||||
} | } | ||||
return; | return; | ||||
@@ -110,14 +109,12 @@ public class Deltree extends Task { | |||||
if (f.isDirectory()) { | if (f.isDirectory()) { | ||||
removeDir(f); | removeDir(f); | ||||
} else { | } else { | ||||
f.delete(); | |||||
if (f.exists()) { | |||||
if (!f.delete()) { | |||||
throw new BuildException("Unable to delete file " + f.getAbsolutePath()); | throw new BuildException("Unable to delete file " + f.getAbsolutePath()); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
dir.delete(); | |||||
if (dir.exists()) { | |||||
if (!dir.delete()) { | |||||
throw new BuildException("Unable to delete directory " + dir.getAbsolutePath()); | throw new BuildException("Unable to delete directory " + dir.getAbsolutePath()); | ||||
} | } | ||||
} | } | ||||