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

Unified Diff: runtime/bin/directory_win.cc

Issue 227913007: Report the correct error, when recursive delete fails on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 eefdd58dd70c0a222ee8d4c21bfefc4d31e083f6..ecfa7e9a5a8fc1f0b9d487e9865fc11c04050cf6 100644
--- a/runtime/bin/directory_win.cc
+++ b/runtime/bin/directory_win.cc
@@ -310,12 +310,15 @@ static bool DeleteRecursively(PathBuffer* path) {
return false;
}
- bool success = DeleteEntry(&find_file_data, path);
-
- while ((FindNextFileW(find_handle, &find_file_data) != 0) && success) {
+ do {
+ if (!DeleteEntry(&find_file_data, path)) {
+ DWORD last_error = GetLastError();
+ FindClose(find_handle);
+ SetLastError(last_error);
+ return false;
+ }
path->Reset(path_length); // DeleteEntry adds to the path.
- success = success && DeleteEntry(&find_file_data, path);
- }
+ } while (FindNextFileW(find_handle, &find_file_data) != 0);
path->Reset(path_length - 1); // Drop the "\" from the end of the path.
if ((GetLastError() != ERROR_NO_MORE_FILES) ||
@@ -324,7 +327,7 @@ static bool DeleteRecursively(PathBuffer* path) {
return false;
}
- return success;
+ return true;
}
« 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