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

Unified Diff: base/scoped_temp_dir.cc

Issue 5340004: Make ScopedTempDir::Delete return a bool so that its functionality can be te... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
Index: base/scoped_temp_dir.cc
===================================================================
--- base/scoped_temp_dir.cc (revision 67430)
+++ base/scoped_temp_dir.cc (working copy)
@@ -57,10 +57,18 @@
return true;
}
-void ScopedTempDir::Delete() {
- if (!path_.empty() && !file_util::Delete(path_, true))
- LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value();
- path_.clear();
+bool ScopedTempDir::Delete() {
+ bool ret = false;
+ if (!path_.empty()) {
Paweł Hajdan Jr. 2010/11/26 21:01:20 nit: Rather: if (path.empty()) return false;
tommi (sloooow) - chröme 2010/11/26 21:04:44 Done.
+ ret = file_util::Delete(path_, true);
+ if (!ret) {
Paweł Hajdan Jr. 2010/11/26 21:01:20 nit: Put success case first to avoid double-negati
tommi (sloooow) - chröme 2010/11/26 21:04:44 Done.
+ // Note that we don't clear the path if we can't delete the directory.
+ LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value();
+ } else {
+ path_.clear();
+ }
+ }
+ return ret;
}
FilePath ScopedTempDir::Take() {

Powered by Google App Engine
This is Rietveld 408576698