re PR libgcj/6652 (new java.io.File("").getCanonicalFile() throws exception)
authorMohan Embar <gnustuff@thisiscool.com>
Fri, 31 Oct 2003 03:02:47 +0000 (03:02 +0000)
committerMohan Embar <membar@gcc.gnu.org>
Fri, 31 Oct 2003 03:02:47 +0000 (03:02 +0000)
PR libgcj/6652:
* java/io/natFileWin32.cc (getCanonicalPath): Treat "" like ".".

From-SVN: r73115

libjava/ChangeLog
libjava/java/io/natFileWin32.cc

index 10b7ab6085d1a85b5d1df60ae470bfec59b54407..b6f7e23aa3624d90f72b27a476c67ce3e8be70a1 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-30  Mohan Embar  <gnustuff@thisiscool.com>
+
+       PR libgcj/6652:
+       * java/io/natFileWin32.cc (getCanonicalPath): Treat "" like ".".
+
 2003-10-30  Bryce McKinlay  <bryce@mckinlay.net.nz>
 
        * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Don't use vtable
index cee6b00ae1f760efa2ea96f6aa70e7765680bd1c..1559043e7ac95f582034dadafb0ceda6240a4a45 100644 (file)
@@ -109,10 +109,15 @@ jstring
 java::io::File::getCanonicalPath (void)
 {
   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"));
 
   // FIXME: what encoding to assume for file names?  This affects many