From: Mohan Embar Date: Fri, 31 Oct 2003 03:02:47 +0000 (+0000) Subject: re PR libgcj/6652 (new java.io.File("").getCanonicalFile() throws exception) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b82183ab3ffc0a17b38c7d1f18377049e70459a1;p=gcc.git re PR libgcj/6652 (new java.io.File("").getCanonicalFile() throws exception) PR libgcj/6652: * java/io/natFileWin32.cc (getCanonicalPath): Treat "" like ".". From-SVN: r73115 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 10b7ab6085d..b6f7e23aa36 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2003-10-30 Mohan Embar + + PR libgcj/6652: + * java/io/natFileWin32.cc (getCanonicalPath): Treat "" like ".". + 2003-10-30 Bryce McKinlay * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Don't use vtable diff --git a/libjava/java/io/natFileWin32.cc b/libjava/java/io/natFileWin32.cc index cee6b00ae1f..1559043e7ac 100644 --- a/libjava/java/io/natFileWin32.cc +++ b/libjava/java/io/natFileWin32.cc @@ -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