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

Unified Diff: chrome/browser/component_updater/component_updater_utils.cc

Issue 113533004: Clean up empty directories after install and on errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « chrome/browser/component_updater/component_updater_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/component_updater/component_updater_utils.cc
diff --git a/chrome/browser/component_updater/component_updater_utils.cc b/chrome/browser/component_updater/component_updater_utils.cc
index e86f72c8a998807080881fc2d0254850bad66545..035d4afd519891fa651185389f87d8a14e79fadb 100644
--- a/chrome/browser/component_updater/component_updater_utils.cc
+++ b/chrome/browser/component_updater/component_updater_utils.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "chrome/browser/component_updater/component_updater_utils.h"
+#include "base/file_util.h"
+#include "base/files/file_path.h"
#include "base/guid.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
@@ -102,10 +104,20 @@ int GetFetchError(const net::URLFetcher& fetcher) {
}
}
-
bool IsHttpServerError(int status_code) {
return 500 <= status_code && status_code < 600;
}
+bool DeleteFileAndEmptyParentDirectory(const base::FilePath& filepath) {
+ if (!base::DeleteFile(filepath, false))
+ return false;
+
+ const base::FilePath dirname(filepath.DirName());
+ if (!base::IsDirectoryEmpty(dirname))
+ return true;
+
+ return base::DeleteFile(dirname, false);
+}
+
cpu_(ooo_6.6-7.5) 2013/12/17 00:48:38 I hope we don't end up deleting %temp% but i guess
Sorin Jianu 2013/12/17 01:19:40 I thought about it but what's the fix? My naive th
} // namespace component_updater
« no previous file with comments | « chrome/browser/component_updater/component_updater_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698