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:
parent
f3ca28bffb
commit
d281f2a236
@ -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
|
||||
|
@ -84,9 +84,9 @@ public class File implements Serializable, Comparable
|
||||
{
|
||||
int dupIndex = p.indexOf(dupSeparator);
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user