diff --git a/filesys.js b/filesys.js index d536c0ce7d8d72bee3a445aaaff429dd8c7b7593..1d49eac842052894e6024110288406884d312b78 100644 --- a/filesys.js +++ b/filesys.js @@ -6,6 +6,7 @@ module.exports = { // get a tree: takes the root (relative the process) and returns all branches below, // includes route-to-root in list getDirTree: (dir, debug) => { + debug = true let tld = dir return new Promise((resolve, reject) => { // items and count, @@ -13,7 +14,7 @@ module.exports = { let count = 0 // recursor, let launch = (dir) => { - if(true) console.log('GDT launch at', dir) + if(debug) console.log('GDT launch at', dir) // just counting actually, count ++ fs.readdir(dir, (err, files) => { @@ -23,10 +24,13 @@ module.exports = { count -- for (file of files) { if (file.includes('.')) { - if(debug) console.log('GDT pushing', `${dir}${file}`) - list.push(`${dir.substring(__dirname.length + tld.length)}/${file}`) + let listAddition = `${dir.substring(__dirname.length + tld.length)}/${file}` + if(debug) console.log('GDT pushing', listAddition) + list.push(listAddition) } else { - launch(`${dir}${file}`) + let launchPoint = `${dir}${file}` + if(debug) console.log('GDT launching', launchPoint) + launch(launchPoint) } } if(debug) console.log('GDT size', count)