From 1f5f6a4bf0163f4dcf0fd6778611891165c334ff Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 10 Nov 2019 20:27:19 -0500 Subject: Bug 1317117 - call msgStore folder deletion during imap/news empty trash. Also factors out some common code into nsMSgDBFolder::Delete(), and makes a couple of incidental changes to try and clarify the responsibilies of nsIMsgPluggableStore::DeleteFolder(). Tag #1273 --- mailnews/local/src/nsMsgMaildirStore.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'mailnews/local/src/nsMsgMaildirStore.cpp') diff --git a/mailnews/local/src/nsMsgMaildirStore.cpp b/mailnews/local/src/nsMsgMaildirStore.cpp index 7a4633367..993abbad5 100644 --- a/mailnews/local/src/nsMsgMaildirStore.cpp +++ b/mailnews/local/src/nsMsgMaildirStore.cpp @@ -323,19 +323,30 @@ NS_IMETHODIMP nsMsgMaildirStore::SetSummaryFileValid(nsIMsgFolder *aFolder, NS_IMETHODIMP nsMsgMaildirStore::DeleteFolder(nsIMsgFolder *aFolder) { NS_ENSURE_ARG_POINTER(aFolder); + bool exists; - // Delete Maildir structure + // Delete the Maildir itself. nsCOMPtr pathFile; nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile)); NS_ENSURE_SUCCESS(rv, rv); - rv = pathFile->Remove(true); // recursive + exists = false; + pathFile->Exists(&exists); + if (exists) { + rv = pathFile->Remove(true); + NS_ENSURE_SUCCESS(rv, rv); + } + + // Delete any subfolders (.sbd-suffixed directories). AddDirectorySeparator(pathFile); - bool exists; + exists = false; pathFile->Exists(&exists); - if (exists) - pathFile->Remove(true); - return rv; + if (exists) { + rv = pathFile->Remove(true); + NS_ENSURE_SUCCESS(rv, rv); + } + + return NS_OK; } NS_IMETHODIMP nsMsgMaildirStore::RenameFolder(nsIMsgFolder *aFolder, -- cgit v1.2.3