This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
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
Attachment:
libgcj.file.patch
Description: libgcj.file.patch
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |