emscripten Humble Cloud interface
Edward Rudd
2014-10-14 163a834cafd43a67abcbf183fb6f97229e219326

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.

1 files modified
22 ■■■■ changed files
client/library/library_cloudfs.js 22 ●●●● patch | view | raw | blame | history
client/library/library_cloudfs.js
@@ -48,7 +48,7 @@
            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 */);
            });
          });
        },
@@ -86,7 +86,7 @@
          });
        },
        // 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 = [];
@@ -100,14 +100,16 @@
          });
          var remove = [];
          Object.keys(dst.entries).forEach(function (key) {
            var e = dst.entries[key];
            var e2 = src.entries[key];
            if (!e2) {
              remove.push(key);
              total++;
            }
          });
          if (!skip_remove) {
              Object.keys(dst.entries).forEach(function (key) {
                  var e = dst.entries[key];
                  var e2 = src.entries[key];
                  if (!e2) {
                      remove.push(key);
                      total++;
                  }
              });
          }
          if (!total) {
            return callback(null);