re PR libgcj/4481 (java.io.File.getParent not working properly)

Fix for PR libgcj/4481:
	* java/io/File.java (getParent): Handle case where path is "/".
	(normalizePath): Use correct string for UNC leader.

From-SVN: r46093
This commit is contained in:
Tom Tromey 2001-10-08 20:42:13 +00:00 committed by Tom Tromey
parent f3ca28bffb
commit d281f2a236
2 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2001-10-08 Tom Tromey <tromey@redhat.com>
Fix for PR libgcj/4481:
* java/io/File.java (getParent): Handle case where path is "/".
(normalizePath): Use correct string for UNC leader.
2001-10-06 Mark Wielaard <mark@klomp.org>
* java/io/BufferedInputStream.java: Merge with Classpath

View File

@ -86,7 +86,7 @@ public class File implements Serializable, Comparable
int plen = p.length();
// Special case: permit Windows UNC path prefix.
if (dupSeparator.equals("\\") && dupIndex == 0)
if (dupSeparator.equals("\\\\") && dupIndex == 0)
dupIndex = p.indexOf(dupSeparator, 1);
if (dupIndex == -1)
@ -181,6 +181,9 @@ public class File implements Serializable, Comparable
int last = path.lastIndexOf(separatorChar);
if (last == -1)
return null;
// FIXME: POSIX assumption.
if (last == 0 && path.charAt (0) == '/')
++last;
return path.substring(0, last);
}