| | |
| | | var path = check.pop(), |
| | | stat, |
| | | keep = true, |
| | | is_dir = false, |
| | | abs_path = PATH.join2(mount.mountpoint, path); |
| | | |
| | | try { |
| | |
| | | |
| | | if (FS.isDir(stat.mode)) { |
| | | check.push.apply(check, FS.readdir(abs_path).filter(isRealDir).map(toAbsolute(path))); |
| | | is_dir = true; |
| | | } else if (shouldFilter) { |
| | | keep = checkPath(path); |
| | | } |
| | |
| | | if (keep) { |
| | | entries[abs_path] = { |
| | | timestamp: stat.mtime, |
| | | path: path |
| | | path: path, |
| | | type: is_dir ? 'dir' : 'file' |
| | | }; |
| | | } |
| | | } |
| | | |
| | | return callback(null, { type: 'local', entries: entries }); |
| | | }, |
| | | getIDBSet: function(mount, callback) { |
| | | var entries = {}, |
| | | toAbsolute = function(p) { return PATH.join2(mount.mountpoint, p); }; |
| | | |
| | | CLOUDFS.getDB(function(err, db) { |
| | | if (err) return callback(err); |
| | | |
| | | var transaction = db.transaction([CLOUDFS.DB_STORE_NAME], 'readonly'); |
| | | transaction.onerror = function() { callback(this.error); }; |
| | | |
| | | var store = transaction.objectStore(CLOUDFS.DB_STORE_NAME); |
| | | var index = store.index('scope'); |
| | | |
| | | index.openKeyCursor(IDBKeyRange.only(mount.opts.scope)).onsuccess = function(event) { |
| | | var cursor = event.target.result; |
| | | |
| | | if (!cursor) { |
| | | return callback(null, { type: 'idb', db: db, entries: entries }); |
| | | } |
| | | |
| | | entries[cursor.primaryKey] = { timestamp: cursor.key }; |
| | | |
| | | cursor.continue(); |
| | | }; |
| | | }); |
| | | }, |
| | | getRemoteSet: function(mount, callback) { |
| | | mount.opts.provider.allFiles(mount.opts.cloud, function(data) { |
| | | var entries = {}, |