| Index: runtime/bin/file_win.cc
|
| diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
|
| index c9f98b560a1e375feea1684c6ed4bde87550611b..28788430ea6df54f8794d5b7dd6731928ef3b12f 100644
|
| --- a/runtime/bin/file_win.cc
|
| +++ b/runtime/bin/file_win.cc
|
| @@ -635,7 +635,12 @@ File::StdioHandleType File::GetStdioHandleType(int fd) {
|
|
|
|
|
| File::Type File::GetType(const char* pathname, bool follow_links) {
|
| - const wchar_t* name = StringUtilsWin::Utf8ToWide(pathname);
|
| + // Convert to wchar_t string.
|
| + int name_len = MultiByteToWideChar(CP_UTF8, 0, pathname, -1, NULL, 0);
|
| + wchar_t* name;
|
| + name = new wchar_t[name_len];
|
| + MultiByteToWideChar(CP_UTF8, 0, pathname, -1, name, name_len);
|
| +
|
| DWORD attributes = GetFileAttributesW(name);
|
| File::Type result = kIsFile;
|
| if (attributes == INVALID_FILE_ATTRIBUTES) {
|
| @@ -662,6 +667,7 @@ File::Type File::GetType(const char* pathname, bool follow_links) {
|
| } else if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
|
| result = kIsDirectory;
|
| }
|
| + delete[] name;
|
| return result;
|
| }
|
|
|
|
|