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
2 changed files with 11 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue