From 163a834cafd43a67abcbf183fb6f97229e219326 Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 14 Oct 2014 16:51:50 +0000
Subject: [PATCH] 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.

---
 client/library/library_cloudfs.js |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/client/library/library_cloudfs.js b/client/library/library_cloudfs.js
index 0fdc01a..ae07c0a 100644
--- a/client/library/library_cloudfs.js
+++ b/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);

--
Gitblit v1.9.3