Browse Source

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
master
Matthew Jason Benson 20 years ago
parent
commit
79b7beb400
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      src/main/org/apache/tools/ant/util/FileUtils.java

+ 7
- 3
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -714,7 +714,7 @@ public class FileUtils {
* @param filename the file name to be checked for being an absolute path. * @param filename the file name to be checked for being an absolute path.
* @return true if the filename represents 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)) { if (filename.startsWith(File.separator)) {
// common for all os // common for all os
return true; return true;
@@ -1166,8 +1166,12 @@ public class FileUtils {
*/ */
public boolean isSymbolicLink(File parent, String name) public boolean isSymbolicLink(File parent, String name)
throws IOException { 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()); return !toTest.getAbsolutePath().equals(toTest.getCanonicalPath());
} }




Loading…
Cancel
Save