Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: runtime/bin/directory_win.cc

Issue 13638028: Report same error-code on windows for all not-found cases. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 423 }
424 424
425 425
426 bool Directory::Delete(const char* dir_name, bool recursive) { 426 bool Directory::Delete(const char* dir_name, bool recursive) {
427 bool result = false; 427 bool result = false;
428 const wchar_t* system_dir_name = StringUtils::Utf8ToWide(dir_name); 428 const wchar_t* system_dir_name = StringUtils::Utf8ToWide(dir_name);
429 if (!recursive) { 429 if (!recursive) {
430 if (File::GetType(dir_name, true) == File::kIsDirectory) { 430 if (File::GetType(dir_name, true) == File::kIsDirectory) {
431 result = (RemoveDirectoryW(system_dir_name) != 0); 431 result = (RemoveDirectoryW(system_dir_name) != 0);
432 } else { 432 } else {
433 SetLastError(ERROR_DIRECTORY); 433 SetLastError(ERROR_FILE_NOT_FOUND);
434 } 434 }
435 } else { 435 } else {
436 PathBuffer path; 436 PathBuffer path;
437 if (path.Add(system_dir_name)) { 437 if (path.Add(system_dir_name)) {
438 result = DeleteRecursively(&path); 438 result = DeleteRecursively(&path);
439 } 439 }
440 } 440 }
441 free(const_cast<wchar_t*>(system_dir_name)); 441 free(const_cast<wchar_t*>(system_dir_name));
442 return result; 442 return result;
443 } 443 }
(...skipping 14 matching lines...) Expand all
458 } 458 }
459 DWORD flags = MOVEFILE_WRITE_THROUGH; 459 DWORD flags = MOVEFILE_WRITE_THROUGH;
460 int move_status = 460 int move_status =
461 MoveFileExW(system_path, system_new_path, flags); 461 MoveFileExW(system_path, system_new_path, flags);
462 free(const_cast<wchar_t*>(system_path)); 462 free(const_cast<wchar_t*>(system_path));
463 free(const_cast<wchar_t*>(system_new_path)); 463 free(const_cast<wchar_t*>(system_new_path));
464 return (move_status != 0); 464 return (move_status != 0);
465 } 465 }
466 466
467 #endif // defined(TARGET_OS_WINDOWS) 467 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698