From 79b7beb40009ddef7ef755f2b3e6022a4bb436c5 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Mon, 31 Jan 2005 22:35:55 +0000 Subject: [PATCH] Fixed isSymbolicLink logic for null parent file; made isAbsolutePath() public. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277564 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/util/FileUtils.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java index 6921aba70..09523ff4c 100644 --- a/src/main/org/apache/tools/ant/util/FileUtils.java +++ b/src/main/org/apache/tools/ant/util/FileUtils.java @@ -714,7 +714,7 @@ public class FileUtils { * @param filename the file name to be checked for being an absolute path. * @return true if the filename represents an absolute path. */ - private static boolean isAbsolutePath(String filename) { + public static boolean isAbsolutePath(String filename) { if (filename.startsWith(File.separator)) { // common for all os return true; @@ -1166,8 +1166,12 @@ public class FileUtils { */ public boolean isSymbolicLink(File parent, String name) throws IOException { - File toTest = new File(((parent == null) - ? null : parent.getCanonicalPath()), name); + if (parent == null) { + File f = new File(name); + parent = f.getParentFile(); + name = f.getName(); + } + File toTest = new File(parent.getCanonicalPath(), name); return !toTest.getAbsolutePath().equals(toTest.getCanonicalPath()); }