Browse Source

Made sure that Project.resolveFile would always use the canonical path

of a file.
Submitted by:	Adam Murdoch <adammurdoch@yahoo.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268055 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
fc10e04872
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      src/main/org/apache/tools/ant/Project.java

+ 9
- 2
src/main/org/apache/tools/ant/Project.java View File

@@ -537,8 +537,15 @@ public class Project {
fileName = fileName.replace('/', File.separatorChar).replace('\\', File.separatorChar); fileName = fileName.replace('/', File.separatorChar).replace('\\', File.separatorChar);


// deal with absolute files // 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 // Eliminate consecutive slashes after the drive spec
if (fileName.length() >= 2 && if (fileName.length() >= 2 &&


Loading…
Cancel
Save