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

Unified Diff: chrome/installer/setup/uninstall.cc

Issue 10832210: Delete the installation folder after deleting its contents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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: chrome/installer/setup/uninstall.cc
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index f4c4d70a253314a8fbfd68c38f7f9964a60ae4f5..206ea493eb25e426229e726238cc0eb183816830 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -445,8 +445,13 @@ DeleteResult DeleteAppHostFilesAndFolders(const InstallerState& installer_state,
if (!file_util::Delete(app_host_exe, false)) {
result = DELETE_FAILED;
LOG(ERROR) << "Failed to delete path: " << app_host_exe.value();
- } else {
- DeleteEmptyParentDir(target_path);
+ } else if (!target_path.empty() && file_util::IsDirectoryEmpty(target_path)) {
gab 2012/08/08 20:32:59 I don't think target_path.empty() is possible at t
erikwright (departed) 2012/08/09 14:52:51 It may be empty if both Chrome and App Host were i
+ if (!file_util::Delete(target_path, true)) {
+ result = DELETE_FAILED;
+ LOG(ERROR) << "Failed to delete folder: " << target_path.value();
+ } else {
+ DeleteEmptyParentDir(target_path);
+ }
}
return result;
@@ -478,7 +483,7 @@ DeleteResult DeleteChromeFilesAndFolders(const InstallerState& installer_state,
if (to_delete.BaseName().value() == installer::kChromeAppHostExe)
continue;
- VLOG(1) << "Deleting install path " << target_path.value();
+ VLOG(1) << "Deleting install path " << to_delete.value();
if (!file_util::Delete(to_delete, true)) {
LOG(ERROR) << "Failed to delete path (1st try): " << to_delete.value();
if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) {
@@ -507,14 +512,21 @@ DeleteResult DeleteChromeFilesAndFolders(const InstallerState& installer_state,
}
if (result == DELETE_REQUIRES_REBOOT) {
+ // Delete the Application directory at reboot if empty.
gab 2012/08/08 20:32:59 This function does not seem to wait for reboot for
erikwright (departed) 2012/08/09 14:52:51 This is the implementation of ScheduleFileSystemEn
gab 2012/08/09 16:07:22 Indeed :), guess I missed that line when reading t
+ ScheduleFileSystemEntityForDeletion(target_path.value().c_str());
// If we need a reboot to continue, schedule the parent directories for
gab 2012/08/08 20:32:59 nit: add empty line between code and comment
erikwright (departed) 2012/08/09 14:52:51 Done.
// deletion unconditionally. If they are not empty, the session manager
// will not delete them on reboot.
ScheduleParentAndGrandparentForDeletion(target_path);
- } else {
- // Now check and delete if the parent directories are empty
- // For example Google\Chrome or Chromium
- DeleteEmptyParentDir(target_path);
+ } else if (file_util::IsDirectoryEmpty(target_path)) {
+ if (!file_util::Delete(target_path, true)) {
+ result = DELETE_FAILED;
+ LOG(ERROR) << "Failed to delete folder: " << target_path.value();
gab 2012/08/08 20:32:59 Seems this log message is duplicated all over this
erikwright (departed) 2012/08/09 14:52:51 I thought about it, but it's also used in DeleteLo
+ } else {
+ // Now check and delete if the parent directories are empty
+ // For example Google\Chrome or Chromium
+ DeleteEmptyParentDir(target_path);
+ }
}
return result;
}
« 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