Submitted by: Jeff Tulley <JTULLEY at novell dot com> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274827 13f79535-47bb-0310-9956-ffa450edef68remotes/1755093904671179446/tmp_b56144731245467e9663415db48f71021337abca
@@ -134,7 +134,7 @@ public class Locator { | |||||
uri = uri.replace('/', File.separatorChar); | uri = uri.replace('/', File.separatorChar); | ||||
if (File.pathSeparatorChar == ';' && uri.startsWith("\\") && uri.length() > 2 | if (File.pathSeparatorChar == ';' && uri.startsWith("\\") && uri.length() > 2 | ||||
&& Character.isLetter(uri.charAt(1)) && uri.charAt(2) == ':') { | |||||
&& Character.isLetter(uri.charAt(1)) && uri.lastIndexOf(':') > -1) { | |||||
uri = uri.substring(1); | uri = uri.substring(1); | ||||
} | } | ||||
@@ -1219,7 +1219,7 @@ public class FileUtils { | |||||
path = normalize(path).getAbsolutePath(); | path = normalize(path).getAbsolutePath(); | ||||
sb.append("//"); | sb.append("//"); | ||||
// add an extra slash for filesystems with drive-specifiers | // add an extra slash for filesystems with drive-specifiers | ||||
if (!path.startsWith("/")) { | |||||
if (!path.startsWith(File.separator)) { | |||||
sb.append("/"); | sb.append("/"); | ||||
} | } | ||||
@@ -438,6 +438,9 @@ public class FileUtilsTest extends TestCase { | |||||
if (Os.isFamily("dos")) { | if (Os.isFamily("dos")) { | ||||
assertEquals("file:///C:/foo", fu.toURI("c:\\foo")); | assertEquals("file:///C:/foo", fu.toURI("c:\\foo")); | ||||
} | } | ||||
if (Os.isFamily("netware")) { | |||||
assertEquals("file:///SYS:/foo", fu.toURI("sys:\\foo")); | |||||
} | |||||
assertEquals("file:///" + dosRoot + "foo", fu.toURI("/foo")); | assertEquals("file:///" + dosRoot + "foo", fu.toURI("/foo")); | ||||
assertEquals("file:./foo", fu.toURI("./foo")); | assertEquals("file:./foo", fu.toURI("./foo")); | ||||
assertEquals("file:///" + dosRoot + "foo", fu.toURI("\\foo")); | assertEquals("file:///" + dosRoot + "foo", fu.toURI("\\foo")); | ||||
@@ -452,6 +455,9 @@ public class FileUtilsTest extends TestCase { | |||||
* test fromUri | * test fromUri | ||||
*/ | */ | ||||
public void testFromURI() { | public void testFromURI() { | ||||
if (Os.isFamily("netware")) { | |||||
assertEqualsIgnoreDriveCase("SYS:\\foo", fu.fromURI("file:///sys:/foo")); | |||||
} | |||||
if (Os.isFamily("dos")) { | if (Os.isFamily("dos")) { | ||||
assertEqualsIgnoreDriveCase("C:\\foo", fu.fromURI("file:///c:/foo")); | assertEqualsIgnoreDriveCase("C:\\foo", fu.fromURI("file:///c:/foo")); | ||||
} | } | ||||