Patch: Fix PR/6652 on MinGW

Mohan Embar gnustuff@thisiscool.com
Fri Oct 31 03:06:00 GMT 2003


Hi All,

>  const char* thepath = cpath.buf ();
>  if (thepath[0] == 0)  // Perhaps (strlen(thepath) == 0) would be less obscure.
>    thepath = ".";
>
>Then you don't need the comment...

I checked the following variant in.

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

ChangeLog
2003-10-30  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	31 Oct 2003 00:17:15 -0000
@@ -110,8 +110,13 @@
 {
   JV_TEMP_UTF_STRING (cpath, path);
+  
+  // If the filename is blank, use the current directory.
+  const char* thepath = cpath.buf();
+  if (*thepath == '\0')
+    thepath = ".";
 
   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-patches mailing list