The AvailableTest brings out a case I didn't code for back when I made NetWare-specific changes to PathTokenizer.java, namely the use of a path of "..:directory", which should resolve to two paths: one directory a level up from basedir, and (IIUC) one directory "directory", relative to the basedir. Looking at PathTest, this is not tested for on any platform. So, I added one test case in the "testConstructorUnixStyle" method, and appropriate code to make NetWare handle this case. It looks like Windows handles this already, if I understand the correct behavior completely. I do not currently have Unix/Linux access (working on it...), so I just made a guess that the Unix case should be handled the same, but with forward slashes.
Please review this new test -- since there were no other tests of these types of relative paths in PathTest, I had to come up with a reliable way to do this without anything else to refer to. There may be other ways to do it. With these changes, AvailableTest no longer fails on NetWare. This change to PathTokenizer is isolated to the code that only executes if you are actually running Ant on NetWare, so it is not risky for other platforms. diff files attached. Thanks, Jeff Tulley ([EMAIL PROTECTED]) (801)861-5322 Novell, Inc., The Leading Provider of Net Business Solutions http://www.novell.com
Index: PathTest.java =================================================================== RCS file: /home/cvspublic/ant/src/testcases/org/apache/tools/ant/types/PathTest.java,v retrieving revision 1.18 diff -u -r1.18 PathTest.java --- PathTest.java 7 Mar 2003 11:23:13 -0000 1.18 +++ PathTest.java 15 Jul 2003 21:18:14 -0000 @@ -102,6 +102,27 @@ assertEquals(":\\a", l[0].substring(1)); assertEquals(":\\b", l[1].substring(1)); } + + project.setBasedir("src/etc"); + p = new Path(project, "..:testcases"); + 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() {
Index: PathTokenizer.java =================================================================== RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/PathTokenizer.java,v retrieving revision 1.17 diff -u -r1.17 PathTokenizer.java --- PathTokenizer.java 9 Jul 2003 13:12:23 -0000 1.17 +++ PathTokenizer.java 15 Jul 2003 21:19:45 -0000 @@ -176,7 +176,8 @@ // make sure we aren't going to get the path separator next if (!nextToken.equals(File.pathSeparator)) { 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 String oneMore = tokenizer.nextToken().trim(); if (!oneMore.equals(File.pathSeparator)) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]