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

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
« no previous file with comments | « base/scoped_temp_dir.h ('k') | base/scoped_temp_dir_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/scoped_temp_dir.cc
===================================================================
--- base/scoped_temp_dir.cc (revision 67531)
+++ base/scoped_temp_dir.cc (working copy)
@@ -11,7 +11,8 @@
}
ScopedTempDir::~ScopedTempDir() {
- Delete();
+ if (!path_.empty() && !Delete())
+ LOG(WARNING) << "Could not delete temp dir in dtor.";
}
bool ScopedTempDir::CreateUniqueTempDir() {
@@ -57,10 +58,19 @@
return true;
}
-void ScopedTempDir::Delete() {
- if (!path_.empty() && !file_util::Delete(path_, true))
+bool ScopedTempDir::Delete() {
+ if (path_.empty())
+ return false;
+
+ bool ret = file_util::Delete(path_, true);
+ if (ret) {
+ // We only clear the path if deleted the directory.
+ path_.clear();
+ } else {
LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value();
- path_.clear();
+ }
+
+ return ret;
}
FilePath ScopedTempDir::Take() {
« no previous file with comments | « base/scoped_temp_dir.h ('k') | base/scoped_temp_dir_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698