Explicitly close file input stream at end of md5Async()
Fixes "Could not remove the non-empty directory at…" file-sync error on Windows Fixes #4246
This commit is contained in:
parent
f7d7625c1c
commit
f829d7c43e
1 changed files with 5 additions and 2 deletions
|
@ -165,9 +165,9 @@ Zotero.Utilities.Internal = {
|
||||||
.createInstance(Components.interfaces.nsICryptoHash);
|
.createInstance(Components.interfaces.nsICryptoHash);
|
||||||
ch.init(ch.MD5);
|
ch.init(ch.MD5);
|
||||||
|
|
||||||
|
var is = Cc["@mozilla.org/network/file-input-stream;1"]
|
||||||
|
.createInstance(Ci.nsIFileInputStream);
|
||||||
try {
|
try {
|
||||||
let is = Cc["@mozilla.org/network/file-input-stream;1"]
|
|
||||||
.createInstance(Ci.nsIFileInputStream);
|
|
||||||
is.init(Zotero.File.pathToFile(file), -1, -1, Ci.nsIFileInputStream.CLOSE_ON_EOF);
|
is.init(Zotero.File.pathToFile(file), -1, -1, Ci.nsIFileInputStream.CLOSE_ON_EOF);
|
||||||
ch.updateFromStream(is, -1);
|
ch.updateFromStream(is, -1);
|
||||||
// Get binary string and convert to hex string
|
// Get binary string and convert to hex string
|
||||||
|
@ -187,6 +187,9 @@ Zotero.Utilities.Internal = {
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue