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

Unified Diff: runtime/bin/directory_win.cc

Issue 9773018: Add error handling to directory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/directory_posix.cc ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_win.cc
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc
index 4091a1550cd0b09274ef7c59d4a66269489f43fa..a2c4ec031cc54222989768be87f692fc5b0ae617 100644
--- a/runtime/bin/directory_win.cc
+++ b/runtime/bin/directory_win.cc
@@ -124,22 +124,8 @@ static bool ComputeFullSearchPath(const char* dir_name,
}
static void PostError(DirectoryListing* listing,
- const char* prefix,
- const char* suffix) {
- char* error_str = Platform::StrError(GetLastError());
- int error_message_size =
- strlen(prefix) + strlen(suffix) + strlen(error_str) + 3;
- char* message = static_cast<char*>(malloc(error_message_size + 1));
- size_t written = snprintf(message,
- error_message_size + 1,
- "%s%s (%s)",
- prefix,
- suffix,
- error_str);
- ASSERT(written == error_message_size);
- free(error_str);
- listing->HandleError(message);
- free(message);
+ const char* dir_name) {
+ listing->HandleError(dir_name);
}
@@ -155,7 +141,7 @@ static bool ListRecursively(const char* dir_name,
int path_length = 0;
bool valid = ComputeFullSearchPath(dir_name, path, &path_length);
if (!valid) {
- PostError(listing, "Directory listing failed for: ", dir_name);
+ PostError(listing, dir_name);
free(path);
return false;
}
@@ -168,7 +154,7 @@ static bool ListRecursively(const char* dir_name,
path[path_length] = '\0';
if (find_handle == INVALID_HANDLE_VALUE) {
- PostError(listing, "Directory listing failed for: ", path);
+ PostError(listing, path);
free(path);
return false;
}
@@ -189,11 +175,12 @@ static bool ListRecursively(const char* dir_name,
if (GetLastError() != ERROR_NO_MORE_FILES) {
success = false;
- PostError(listing, "Directory listing failed", "");
+ PostError(listing, dir_name);
}
if (FindClose(find_handle) == 0) {
- PostError(listing, "Failed to close directory", "");
+ success = false;
+ PostError(listing, dir_name);
}
free(path);
« no previous file with comments | « runtime/bin/directory_posix.cc ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698