Patch: Fix PR/6652 on MinGW

Mohan Embar gnustuff@thisiscool.com
Sat Oct 18 17:35:00 GMT 2003


Hi People,

>> With normal (Sun) java, a File("") object will return a canonicalPath of the 
>> current directory.
>> 
>> With gcj java, this returns a "java.io.IOException: GetFullPathName failed"   
>> Is this normal?  It is causing compatibility problems when compiling SWT/JFace 
>> apps (and probably others..)
>> 
>> Tested on Windows with gcj 3.3.1, and gcj version 3.4 20031006 (experimental).
>
>This works on linux (2.4.21). Seems to be a Windows specific problem.

This fixes PR/6652 on MinGW.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

ChangeLog
2003-10-18  Mohan Embar  <gnustuff@thisiscool.com>

	PR libgcj/6652:
	* java/io/natFileWin32.cc (getCanonicalPath): Treat "" like ".".

Index: java/io/natFileWin32.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/natFileWin32.cc,v
retrieving revision 1.17
diff -u -2 -r1.17 natFileWin32.cc
--- java/io/natFileWin32.cc	29 Aug 2003 04:21:00 -0000	1.17
+++ java/io/natFileWin32.cc	18 Oct 2003 17:28:07 -0000
@@ -110,8 +110,11 @@
 {
   JV_TEMP_UTF_STRING (cpath, path);
+  
+  const char* thepath = *cpath.buf() ? cpath.buf() : ".";
+    // "" becomes "."
 
   LPTSTR unused;
   char buf2[MAX_PATH];
-  if(!GetFullPathName(cpath, MAX_PATH, buf2, &unused))
+  if(!GetFullPathName(thepath, MAX_PATH, buf2, &unused))
     throw new IOException (JvNewStringLatin1 ("GetFullPathName failed"));
 





More information about the Java mailing list