Finish dictionary installation even if file cleanup fails (on Windows)
This commit is contained in:
parent
aef07afd32
commit
a50b7ef04a
1 changed files with 14 additions and 10 deletions
|
@ -136,20 +136,11 @@ Zotero.Dictionaries = new function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
zipReader.close();
|
zipReader.close();
|
||||||
zipReader = null
|
zipReader = null;
|
||||||
Cu.forceGC();
|
Cu.forceGC();
|
||||||
await OS.File.remove(xpiPath);
|
|
||||||
await _loadDirectory(dir);
|
await _loadDirectory(dir);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
try {
|
|
||||||
if (await OS.File.exists(xpiPath)) {
|
|
||||||
await OS.File.remove(xpiPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
Zotero.logError(e);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (await OS.File.exists(dir)) {
|
if (await OS.File.exists(dir)) {
|
||||||
await OS.File.removeDir(dir);
|
await OS.File.removeDir(dir);
|
||||||
|
@ -160,6 +151,19 @@ Zotero.Dictionaries = new function () {
|
||||||
}
|
}
|
||||||
throw e;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue