| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
| 9 #include "bin/file.h" | 9 #include "bin/file.h" |
| 10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 Directory::ExistsResult Directory::Exists(const char* dir_name) { | 344 Directory::ExistsResult Directory::Exists(const char* dir_name) { |
| 345 const wchar_t* system_name = StringUtils::Utf8ToWide(dir_name); | 345 const wchar_t* system_name = StringUtils::Utf8ToWide(dir_name); |
| 346 Directory::ExistsResult result = ExistsHelper(system_name); | 346 Directory::ExistsResult result = ExistsHelper(system_name); |
| 347 free(const_cast<wchar_t*>(system_name)); | 347 free(const_cast<wchar_t*>(system_name)); |
| 348 return result; | 348 return result; |
| 349 } | 349 } |
| 350 | 350 |
| 351 | 351 |
| 352 char* Directory::Current() { | 352 char* Directory::Current() { |
| 353 int length = GetCurrentDirectoryW(0, NULL); | 353 int length = GetCurrentDirectoryW(0, NULL); |
| 354 if (length == 0) return NULL; |
| 354 wchar_t* current = new wchar_t[length + 1]; | 355 wchar_t* current = new wchar_t[length + 1]; |
| 355 GetCurrentDirectoryW(length + 1, current); | 356 GetCurrentDirectoryW(length + 1, current); |
| 356 char* result = StringUtils::WideToUtf8(current); | 357 char* result = StringUtils::WideToUtf8(current); |
| 357 delete[] current; | 358 delete[] current; |
| 358 return result; | 359 return result; |
| 359 } | 360 } |
| 360 | 361 |
| 361 | 362 |
| 362 bool Directory::SetCurrent(const char* path) { | 363 bool Directory::SetCurrent(const char* path) { |
| 363 const wchar_t* system_path = StringUtils::Utf8ToWide(path); | 364 const wchar_t* system_path = StringUtils::Utf8ToWide(path); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 MoveFileExW(system_path, system_new_path, flags); | 469 MoveFileExW(system_path, system_new_path, flags); |
| 469 free(const_cast<wchar_t*>(system_path)); | 470 free(const_cast<wchar_t*>(system_path)); |
| 470 free(const_cast<wchar_t*>(system_new_path)); | 471 free(const_cast<wchar_t*>(system_new_path)); |
| 471 return (move_status != 0); | 472 return (move_status != 0); |
| 472 } | 473 } |
| 473 | 474 |
| 474 } // namespace bin | 475 } // namespace bin |
| 475 } // namespace dart | 476 } // namespace dart |
| 476 | 477 |
| 477 #endif // defined(TARGET_OS_WINDOWS) | 478 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |