File.java (normalizePath): Remove trailing separator on Windows only if path is not of the form "x:\".
2003-03-01 Ranjit Mathew <rmathew@hotmail.com> * java/io/File.java (normalizePath): Remove trailing separator on Windows only if path is not of the form "x:\". * java/io/natFileWin32.cc (WIN32_EPOCH_MILLIS): New constant. (java::io::File::attr): Change formatting a bit and use WIN32_EPOCH_MILLIS instead of magic numbers. (java::io::File::isAbsolute): Path must have at least 3 characters for a UNC network path. (java::io::File::init_native): Define. (java::io::File::performCreate): Likewise. (java::io::File::performSetReadOnly): Likewise. (java::io::File::performSetLastModified): Likewise. (java::io::File::performListRoots): Likewise. From-SVN: r63646
This commit is contained in:
parent
d457094cc1
commit
3ccd3d7041
3 changed files with 170 additions and 20 deletions
|
@ -96,9 +96,13 @@ public class File implements Serializable, Comparable
|
|||
|
||||
if (dupIndex == -1)
|
||||
{
|
||||
// Ignore trailing separator.
|
||||
if (plen > 1 && p.charAt(plen - 1) == separatorChar)
|
||||
return p.substring(0, plen - 1);
|
||||
// Ignore trailing separator (though on Windows "a:\", for
|
||||
// example, is a valid and minimal path).
|
||||
if (plen > 1 && p.charAt (plen - 1) == separatorChar)
|
||||
{
|
||||
if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':'))
|
||||
return p.substring (0, plen - 1);
|
||||
}
|
||||
else
|
||||
return p;
|
||||
}
|
||||
|
@ -120,10 +124,16 @@ public class File implements Serializable, Comparable
|
|||
dupIndex = p.indexOf(dupSeparator, last);
|
||||
}
|
||||
|
||||
// Again, ignore possible trailing separator.
|
||||
// Again, ignore possible trailing separator (except special cases
|
||||
// like "a:\" on Windows).
|
||||
int end;
|
||||
if (plen > 1 && p.charAt(plen - 1) == separatorChar)
|
||||
end = plen - 1;
|
||||
if (plen > 1 && p.charAt (plen - 1) == separatorChar)
|
||||
{
|
||||
if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')
|
||||
end = plen;
|
||||
else
|
||||
end = plen - 1;
|
||||
}
|
||||
else
|
||||
end = plen;
|
||||
newpath.append(p.substring(last, end));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue