www

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

commit 020cf3ee955d9b4f6815b0b18fba29fa4d88f683
parent b4dab3ce9ce295f8322142ea12bff0d37a4d0f8b
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 27 Nov 2009 21:39:11 +0000

Try to fix Windows file access error on syncing of modified files


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

diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js @@ -1050,9 +1050,10 @@ Zotero.Sync.Storage = new function () { // Delete existing files var otherFiles = parentDir.directoryEntries; - while (otherFiles.hasMoreElements()) { - var file = otherFiles.getNext(); - file.QueryInterface(Components.interfaces.nsIFile); + otherFiles.QueryInterface(Components.interfaces.nsIDirectoryEnumerator); + var filesToDelete = []; + var file; + while (file = otherFiles.nextFile) { if (file.leafName[0] == '.') { continue; } @@ -1076,6 +1077,12 @@ Zotero.Sync.Storage = new function () { continue; } + filesToDelete.push(file); + } + otherFiles.close(); + + // Do deletes outside of the enumerator to avoid an access error on Windows + for each(var file in filesToDelete) { if (file.isFile()) { Zotero.debug("Deleting existing file " + file.leafName); try {