in src/browser/FileProxy.js [913:942]
tx.oncomplete = function () {
results = results.filter(function (val) {
let pathWithoutSlash = val.fullPath;
if (val.fullPath[val.fullPath.length - 1] === DIR_SEPARATOR) {
pathWithoutSlash = pathWithoutSlash.substr(0, pathWithoutSlash.length - 1);
}
const valPartsLen = pathWithoutSlash.split(DIR_SEPARATOR).length;
let fullPathPartsLen = fullPath.split(DIR_SEPARATOR).length;
/* Input fullPath parameter equals '//' for root folder */
/* Entries in root folder has valPartsLen equals 2 (see below) */
if (fullPath[fullPath.length - 1] === DIR_SEPARATOR && fullPath.trim().length === 2) {
fullPathPartsLen = 1;
} else if (fullPath[fullPath.length - 1] === DIR_SEPARATOR) {
fullPathPartsLen = fullPath.substr(0, fullPath.length - 1).split(DIR_SEPARATOR).length;
} else {
fullPathPartsLen = fullPath.split(DIR_SEPARATOR).length;
}
if (valPartsLen === fullPathPartsLen + 1) {
// If this a subfolder and entry is a direct child, include it in
// the results. Otherwise, it's not an entry of this folder.
return val;
} else return false;
});
successCallback(results);
};