summaryrefslogtreecommitdiffstats
path: root/mailnews/local/src/nsMsgMaildirStore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/local/src/nsMsgMaildirStore.cpp')
-rw-r--r--mailnews/local/src/nsMsgMaildirStore.cpp23
1 files changed, 17 insertions, 6 deletions
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<nsIFile> 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,