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

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

Issue 11312242: Revised CL for customisable logging (replacing printfs). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « runtime/bin/dbg_connection_macos.cc ('k') | runtime/bin/eventhandler_android.cc » ('j') | 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 "bin/directory.h" 5 #include "bin/directory.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 9
10 #include "bin/platform.h" 10 #include "bin/log.h"
11
12 11
13 static int SetOsErrorMessage(char* os_error_message, 12 static int SetOsErrorMessage(char* os_error_message,
14 int os_error_message_len) { 13 int os_error_message_len) {
15 int error_code = GetLastError(); 14 int error_code = GetLastError();
16 DWORD message_size = 15 DWORD message_size =
17 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 16 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
18 NULL, 17 NULL,
19 error_code, 18 error_code,
20 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 19 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
21 os_error_message, 20 os_error_message,
22 os_error_message_len, 21 os_error_message_len,
23 NULL); 22 NULL);
24 if (message_size == 0) { 23 if (message_size == 0) {
25 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { 24 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
26 fprintf(stderr, "FormatMessage failed %d\n", GetLastError()); 25 Log::PrintErr("FormatMessage failed %d\n", GetLastError());
27 } 26 }
28 snprintf(os_error_message, os_error_message_len, "OS Error %d", error_code); 27 snprintf(os_error_message, os_error_message_len, "OS Error %d", error_code);
29 } 28 }
30 os_error_message[os_error_message_len - 1] = '\0'; 29 os_error_message[os_error_message_len - 1] = '\0';
31 return error_code; 30 return error_code;
32 } 31 }
33 32
34 33
35 // Forward declaration. 34 // Forward declaration.
36 static bool ListRecursively(const char* dir_name, 35 static bool ListRecursively(const char* dir_name,
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 bool success = DeleteRecursively(system_new_path); 461 bool success = DeleteRecursively(system_new_path);
463 if (!success) return false; 462 if (!success) return false;
464 } 463 }
465 DWORD flags = MOVEFILE_WRITE_THROUGH; 464 DWORD flags = MOVEFILE_WRITE_THROUGH;
466 int move_status = 465 int move_status =
467 MoveFileEx(system_path, system_new_path, flags); 466 MoveFileEx(system_path, system_new_path, flags);
468 free(const_cast<char*>(system_path)); 467 free(const_cast<char*>(system_path));
469 free(const_cast<char*>(system_new_path)); 468 free(const_cast<char*>(system_new_path));
470 return (move_status != 0); 469 return (move_status != 0);
471 } 470 }
OLDNEW
« no previous file with comments | « runtime/bin/dbg_connection_macos.cc ('k') | runtime/bin/eventhandler_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698