Bug 1722777 - Pre: Reuse existing directory iteration function when deleting folder content on Windows. r=nalexander

Depends on D140428

Differential Revision: https://phabricator.services.mozilla.com/D140910
This commit is contained in:
Nicholas Rishel 2022-03-22 00:28:22 +00:00
parent 9e17c0d135
commit 38f65972b7

View File

@ -2315,14 +2315,9 @@ nsLocalFile::Remove(bool aRecursive) {
return rv;
}
bool more = false;
while (NS_SUCCEEDED(dirEnum->HasMoreElements(&more)) && more) {
nsCOMPtr<nsISupports> item;
dirEnum->GetNext(getter_AddRefs(item));
nsCOMPtr<nsIFile> file = do_QueryInterface(item);
if (file) {
file->Remove(aRecursive);
}
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED(dirEnum->GetNextFile(getter_AddRefs(file))) && file) {
file->Remove(aRecursive);
}
}
if (RemoveDirectoryW(mWorkingPath.get()) == 0) {