following a colon in Unix style PATH structures on Netware. Submitted by: Jeff Tulley <JTULLEY at novell dot com> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274829 13f79535-47bb-0310-9956-ffa450edef68master
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2000,2002 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -176,7 +176,9 @@ public class PathTokenizer { | |||||
// make sure we aren't going to get the path separator next | // make sure we aren't going to get the path separator next | ||||
if (!nextToken.equals(File.pathSeparator)) { | if (!nextToken.equals(File.pathSeparator)) { | ||||
if (nextToken.equals(":")) { | if (nextToken.equals(":")) { | ||||
if (!token.startsWith("/") && !token.startsWith("\\")) { | |||||
if (!token.startsWith("/") && !token.startsWith("\\") | |||||
&& !token.startsWith(".") | |||||
&& !token.startsWith("..")) { | |||||
// it indeed is a drive spec, get the next bit | // it indeed is a drive spec, get the next bit | ||||
String oneMore = tokenizer.nextToken().trim(); | String oneMore = tokenizer.nextToken().trim(); | ||||
if (!oneMore.equals(File.pathSeparator)) { | if (!oneMore.equals(File.pathSeparator)) { | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -104,6 +104,29 @@ public class PathTest extends TestCase { | |||||
} | } | ||||
} | } | ||||
public void testRelativePathUnixStyle() { | |||||
project.setBasedir("src/etc"); | |||||
Path p = new Path(project, "..:testcases"); | |||||
String[] l = p.list(); | |||||
assertEquals("two items, Unix style", 2, l.length); | |||||
if (isUnixStyle) { | |||||
assertTrue("test resolved relative to src/etc", | |||||
l[0].endsWith("/src")); | |||||
assertTrue("test resolved relative to src/etc", | |||||
l[1].endsWith("/src/etc/testcases")); | |||||
} else if (isNetWare) { | |||||
assertTrue("test resolved relative to src/etc", | |||||
l[0].endsWith("\\src")); | |||||
assertTrue("test resolved relative to src/etc", | |||||
l[1].endsWith("\\src\\etc\\testcases")); | |||||
} else { | |||||
assertTrue("test resolved relative to src/etc", | |||||
l[0].endsWith("\\src")); | |||||
assertTrue("test resolved relative to src/etc", | |||||
l[1].endsWith("\\src\\etc\\testcases")); | |||||
} | |||||
} | |||||
public void testConstructorWindowsStyle() { | public void testConstructorWindowsStyle() { | ||||
Path p = new Path(project, "\\a;\\b"); | Path p = new Path(project, "\\a;\\b"); | ||||
String[] l = p.list(); | String[] l = p.list(); | ||||