client/js/dnd.js
function getFilesInDirectory(entry, reader, accumEntries, existingPromise) {
        var promise = existingPromise || new qq.Promise(),
            dirReader = reader || entry.createReader();

        dirReader.readEntries(
            function readSuccess(entries) {
                var newEntries = accumEntries ? accumEntries.concat(entries) : entries;

                if (entries.length) {
                    setTimeout(function() { // prevent stack overflow, however unlikely
                        getFilesInDirectory(entry, dirReader, newEntries, promise);
                    }, 0);
                }
                else {
                    promise.success(newEntries);
                }
            },

            promise.failure
        );

        return promise;
    }
function getFilesInDirectory(entry, reader, accumEntries, existingPromise) {
        var promise = existingPromise || new qq.Promise(),
            dirReader = reader || entry.createReader();

        dirReader.readEntries(
            function readSuccess(entries) {
                var newEntries = accumEntries ? accumEntries.concat(entries) : entries;

                if (entries.length) {
                    setTimeout(function() { // prevent stack overflow, however unlikely
                        getFilesInDirectory(entry, dirReader, newEntries, promise);
                    }, 0);
                }
                else {
                    promise.success(newEntries);
                }
            },

            promise.failure
        );

        return promise;
    }
function getFilesInDirectory ( entry , reader , accumEntries , existingPromise ) { var promise = existingPromise || new qq . Promise ( ) , dirReader = reader || entry . createReader ( ) ; dirReader . readEntries ( function readSuccess ( entries ) { var newEntries = accumEntries ? accumEntries . concat ( entries ) : entries ; if ( entries . length ) { setTimeout ( function ( ) { // prevent stack overflow, however unlikely getFilesInDirectory ( entry , dirReader , newEntries , promise ) ; } , 0 ) ; } else { promise . success ( newEntries ) ; } } , promise . failure ) ; return promise ; }
Promissory.  Guaranteed to read all files in the root of the passed directory.
Promissory . Guaranteed to read all files in the root of the passed directory .