Bug 1180901 - Catch the error when trying to remove the trash directory when it contains a file that is locked r=mossop

--HG--
extra : amend_source : feb4bcc17812d4dc2fae99895ff4f6bb6a94ab9f
This commit is contained in:
Trevor Rowbotham 2015-08-20 13:46:48 -07:00
parent 4076f4a2c1
commit ec8d23fdb0

View File

@ -7663,9 +7663,17 @@ DirectoryInstallLocation.prototype = {
getTrashDir: function DirInstallLocation_getTrashDir() {
let trashDir = this._directory.clone();
trashDir.append(DIR_TRASH);
if (trashDir.exists())
recursiveRemove(trashDir);
trashDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let trashDirExists = trashDir.exists();
try {
if (trashDirExists)
recursiveRemove(trashDir);
trashDirExists = false;
} catch (e) {
logger.warn("Failed to remove trash directory", e);
}
if (!trashDirExists)
trashDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
return trashDir;
},