summaryrefslogtreecommitdiff
path: root/src/main/org
diff options
context:
space:
mode:
authorStefan Bodewig <bodewig@apache.org>2002-06-10 06:19:32 +0000
committerStefan Bodewig <bodewig@apache.org>2002-06-10 06:19:32 +0000
commitf40cbc60b34a952432e7abfb70181d0feabd4dd6 (patch)
treeb4746cdf5add36c99a67fccba128f82cdb86d57d /src/main/org
parent5b320cdc202a575a067f3dacbd06bff3ebc43f83 (diff)
downloadant-f40cbc60b34a952432e7abfb70181d0feabd4dd6.tar.gz
Merge over a bug-fix needed to get jakarta-tomcat built by Gump.
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272855 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/main/org')
-rw-r--r--src/main/org/apache/tools/ant/util/FileUtils.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java
index b6a5dc8ae..45f992620 100644
--- a/src/main/org/apache/tools/ant/util/FileUtils.java
+++ b/src/main/org/apache/tools/ant/util/FileUtils.java
@@ -866,14 +866,14 @@ public class FileUtils {
* @since Ant 1.5
*/
public String removeLeadingPath(File leading, File path) {
- String l = normalize(leading.getAbsolutePath()).getAbsolutePath();
+ // if leading's path ends with a slash, it will be stripped by
+ // normalize - we always add one so we never think /foo was a
+ // parent directory of /foobar
+ String l = normalize(leading.getAbsolutePath()).getAbsolutePath()
+ + File.separator;
String p = normalize(path.getAbsolutePath()).getAbsolutePath();
if (p.startsWith(l)) {
- String result = p.substring(l.length());
- if (result.startsWith(File.separator)) {
- result = result.substring(File.separator.length());
- }
- return result;
+ return p.substring(l.length());
} else {
return p;
}