when fetching from the cloud don’t REMOVE local files.. This allows a local storage and cloud to "merge" so users won’t lose their offline saves.
| | |
| | | CLOUDFS.getIDBSet(mount, function(err, idb) { |
| | | if (err) return callback(err); |
| | | |
| | | CLOUDFS.reconcile(mount, remote, idb, callback); |
| | | CLOUDFS.reconcile(mount, remote, idb, callback, true /* skip remove */); |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | }); |
| | | }, |
| | | // handling the diffing of "haves" and "have nots" |
| | | reconcile: function(mount, src, dst, callback) { |
| | | reconcile: function(mount, src, dst, callback, skip_remove) { |
| | | var total = 0; |
| | | |
| | | var create = []; |
| | |
| | | }); |
| | | |
| | | var remove = []; |
| | | if (!skip_remove) { |
| | | Object.keys(dst.entries).forEach(function (key) { |
| | | var e = dst.entries[key]; |
| | | var e2 = src.entries[key]; |
| | |
| | | total++; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (!total) { |
| | | return callback(null); |