From fc10e04872fc692d845c3f2777e9ca3e423056a2 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 4 Oct 2000 09:57:55 +0000 Subject: [PATCH] Made sure that Project.resolveFile would always use the canonical path of a file. Submitted by: Adam Murdoch git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268055 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/Project.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 8457a378a..d1126f0f5 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -537,8 +537,15 @@ public class Project { fileName = fileName.replace('/', File.separatorChar).replace('\\', File.separatorChar); // deal with absolute files - if (fileName.startsWith(File.separator)) - return new File( fileName ); + if (fileName.startsWith(File.separator)) { + try { + return new File(new File(fileName).getCanonicalPath()); + } catch (IOException e) { + log("IOException getting canonical path for " + fileName + + ": " + e.getMessage(), MSG_ERR); + return new File(fileName); + } + } // Eliminate consecutive slashes after the drive spec if (fileName.length() >= 2 &&