This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Patch: Fix PR/6652 on MinGW
- From: Mohan Embar <gnustuff at thisiscool dot com>
- To: Rutger Ovidius <ovid at mailandnews dot com>, Michael Koch <konqueror at gmx dot de>
- Cc: java at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Sat, 18 Oct 2003 12:35:04 -0500
- Subject: Patch: Fix PR/6652 on MinGW
- Reply-to: gnustuff at thisiscool dot com
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"));