java.io.File
Jeroen Frijters
jeroen@sumatra.nl
Thu Jul 22 11:48:00 GMT 2004
Hi,
I just merged libgcj's Windows support in java.io.File to Classpath's
java.io.File and I noticed two small bugs. Attached is a patch for
gcc/libjava/java/io/File.java that adds support for "\c:" style paths to
normalizePath.
The second issue is a bit subtle. The native Win32 implementation of
getCanonicalPath, will resolve a relative file based on the current
Win32 directory, not the user.dir Java system property. Here's what I
ended up doing:
public String getCanonicalPath() throws IOException
{
// On Windows, getAbsolutePath might end up calling us, so we
// have to special case that call to avoid infinite recursion.
if (separatorChar == '\\' && path.length() == 2 &&
((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') ||
(path.charAt(0) >= 'A' && path.charAt(0) <= 'Z')) &&
path.charAt(1) == ':')
{
return VMFile.toCanonicalForm(path);
}
// Call getAbsolutePath first to make sure that we do the
// current directory handling, because the native code
// may have a different idea of the current directory.
return VMFile.toCanonicalForm(getAbsolutePath());
}
Regards,
Jeroen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgcj.file.patch
Type: application/octet-stream
Size: 945 bytes
Desc: libgcj.file.patch
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040722/df1bca4b/attachment.obj>
More information about the Java
mailing list