implement File.getAbsoluteFile for Windows

This commit is contained in:
Joel Dice 2012-02-16 18:19:01 -07:00
parent a254d20e0e
commit c5ef39f2bd

View File

@ -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<const jchar*>(buffer), wcslen(buffer));
}
}
return path;
#else
jstring result = path;