From c5ef39f2bd6d5911ca41b0c1887277ecdfbde9b9 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 16 Feb 2012 18:19:01 -0700 Subject: [PATCH] implement File.getAbsoluteFile for Windows --- classpath/java-io.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index c851a0d75a..ff728b5365 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -323,7 +323,19 @@ extern "C" JNIEXPORT jstring JNICALL Java_java_io_File_toAbsolutePath(JNIEnv* e UNUSED, jclass, jstring path) { #ifdef PLATFORM_WINDOWS - // todo + string_t chars = getChars(e, path); + if (chars) { + const unsigned BufferSize = MAX_PATH; + char_t buffer[BufferSize]; + DWORD success = GetFullPathNameW(chars, BufferSize, buffer, 0); + releaseChars(e, path, chars); + + if (success) { + return e->NewString + (reinterpret_cast(buffer), wcslen(buffer)); + } + } + return path; #else jstring result = path;