diff options
Diffstat (limited to 'mailnews/local/src/nsMsgBrkMBoxStore.cpp')
-rw-r--r-- | mailnews/local/src/nsMsgBrkMBoxStore.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/mailnews/local/src/nsMsgBrkMBoxStore.cpp b/mailnews/local/src/nsMsgBrkMBoxStore.cpp index 31836dd3c..1ab464385 100644 --- a/mailnews/local/src/nsMsgBrkMBoxStore.cpp +++ b/mailnews/local/src/nsMsgBrkMBoxStore.cpp @@ -300,26 +300,30 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::SetSummaryFileValid(nsIMsgFolder *aFolder, NS_IMETHODIMP nsMsgBrkMBoxStore::DeleteFolder(nsIMsgFolder *aFolder) { NS_ENSURE_ARG_POINTER(aFolder); - //Delete mailbox + bool exists; + + // Delete mbox file. nsCOMPtr<nsIFile> pathFile; nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile)); NS_ENSURE_SUCCESS(rv, rv); - pathFile->Remove(false); + exists = false; + pathFile->Exists(&exists); + if (exists) { + rv = pathFile->Remove(false); + NS_ENSURE_SUCCESS(rv, rv); + } - bool isDirectory = false; - pathFile->IsDirectory(&isDirectory); - if (!isDirectory) - { - nsAutoString leafName; - pathFile->GetLeafName(leafName); - leafName.AppendLiteral(FOLDER_SUFFIX); - pathFile->SetLeafName(leafName); + // Delete any subfolders (.sbd-suffixed directories). + AddDirectorySeparator(pathFile); + exists = false; + pathFile->Exists(&exists); + if (exists) { + rv = pathFile->Remove(true); + NS_ENSURE_SUCCESS(rv, rv); } - isDirectory = false; - pathFile->IsDirectory(&isDirectory); - //If this is a directory, then remove it. - return isDirectory ? pathFile->Remove(true) : NS_OK; + + return NS_OK; } NS_IMETHODIMP nsMsgBrkMBoxStore::RenameFolder(nsIMsgFolder *aFolder, |