www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 610017e4dfd70a06f311ce648b540fe051019f06
parent 4af73f4a5261282f492b3a4f9b4f14567ee55107
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu,  8 Aug 2013 14:15:41 -0400

Fix file sync error on Windows

Diffstat:
Mchrome/content/zotero/xpcom/storage.js | 25+++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js @@ -1027,16 +1027,21 @@ Zotero.Sync.Storage = new function () { return Zotero.Utilities.Internal.md5Async(file) .then(function (fileHash) { if (row.hash && row.hash == fileHash) { - Zotero.debug("Mod time didn't match (" + fmtime + "!=" + mtime + ") " - + "but hash did for " + nsIFile.leafName + " for item " + lk - + " -- updating file mod time"); - try { - nsIFile.lastModifiedTime = row.mtime; - } - catch (e) { - Zotero.File.checkFileAccessError(e, nsIFile, 'update'); - } - return; + // We have to close the file before modifying it from the main + // thread (at least on Windows, where assigning lastModifiedTime + // throws an NS_ERROR_FILE_IS_LOCKED otherwise) + return Q(file.close()) + .then(function () { + Zotero.debug("Mod time didn't match (" + fmtime + "!=" + mtime + ") " + + "but hash did for " + nsIFile.leafName + " for item " + lk + + " -- updating file mod time"); + try { + nsIFile.lastModifiedTime = row.mtime; + } + catch (e) { + Zotero.File.checkFileAccessError(e, nsIFile, 'update'); + } + }); } // Mark file for upload