summaryrefslogtreecommitdiffstats
path: root/libjava/java/io/natFileWin32.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-01 23:38:13 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-01 23:38:13 +0000
commitd03da085bc50e83dbbf4ec4e29fdf17fa9973e6e (patch)
tree4cd6d3bffb8812360e139400a1ec89459ba0a0d9 /libjava/java/io/natFileWin32.cc
parentb25365b4d3ea834d6c65c5893a85a7df172f56e9 (diff)
downloadppe42-gcc-d03da085bc50e83dbbf4ec4e29fdf17fa9973e6e.tar.gz
ppe42-gcc-d03da085bc50e83dbbf4ec4e29fdf17fa9973e6e.zip
2003-03-01 Ranjit Mathew <rmathew@hotmail.com>
* java/io/File (getAbsolutePath): Prefix drive specifier on Windows for paths starting with a '\'. (toURL): Make URL more consistent with what Sun's JDK returns. * java/io/natFileWin32.cc (java::io::File::isAbsolute): Return true only if the path is a UNC network path or it starts with a drive specifier. * java/net/URLStreamHandler.java (parseURL): Correct minor typo. Be prepared to handle either '/' or '\\' in the file path for Windows if using the "file" protocol. Canonicalise the file path if using a relative path in the given context and the "file" protocol. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63635 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/natFileWin32.cc')
-rw-r--r--libjava/java/io/natFileWin32.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/libjava/java/io/natFileWin32.cc b/libjava/java/io/natFileWin32.cc
index 5245feb5a1e..9029881e165 100644
--- a/libjava/java/io/natFileWin32.cc
+++ b/libjava/java/io/natFileWin32.cc
@@ -119,9 +119,14 @@ java::io::File::getCanonicalPath (void)
jboolean
java::io::File::isAbsolute (void)
{
- if (path->length() > 0
- && (path->charAt(0) == '/' || path->charAt(0) == '\\'))
+ // See if the path represents a Windows UNC network path.
+ if (path->length () > 1
+ && (path->charAt (0) == '\\') && (path->charAt (1) == '\\'))
return true;
+
+ // Note that the path is not an absolute path even if it starts with
+ // a '/' or a '\' because it lacks a drive specifier.
+
if (path->length() < 3)
return false;
// Hard-code A-Za-z because Windows (I think) can't use non-ASCII
OpenPOWER on IntegriCloud