diff --git a/chrome/content/zotero/xpcom/dictionaries.js b/chrome/content/zotero/xpcom/dictionaries.js index 4cdabf0cb0..0354893f51 100644 --- a/chrome/content/zotero/xpcom/dictionaries.js +++ b/chrome/content/zotero/xpcom/dictionaries.js @@ -136,20 +136,11 @@ Zotero.Dictionaries = new function () { } zipReader.close(); - zipReader = null + zipReader = null; Cu.forceGC(); - await OS.File.remove(xpiPath); await _loadDirectory(dir); } catch (e) { - try { - if (await OS.File.exists(xpiPath)) { - await OS.File.remove(xpiPath); - } - } - catch (e) { - Zotero.logError(e); - } try { if (await OS.File.exists(dir)) { await OS.File.removeDir(dir); @@ -160,6 +151,19 @@ Zotero.Dictionaries = new function () { } throw e; } + finally { + // Remove the downloaded file from the temp path + // Note: In same cases, on Windows, it can't be removed + // because something is keeping it open + try { + if (await OS.File.exists(xpiPath)) { + await OS.File.remove(xpiPath); + } + } + catch (e) { + Zotero.logError(e); + } + } }; /**