diff --git a/cf.js b/cf.js index 2360310fba054de1d8273fbab35db29bcaa7ef95..e8281eb5e343ab87edea0db4b246bc6006ee3d64 100644 --- a/cf.js +++ b/cf.js @@ -26,16 +26,17 @@ app.get('/fileList', (req, res) => { // we would fs/ through our list, and serve that, filesys.getDirTree(req.query.path).then((list) => { // take the query out of the front of the path, and swap all \ for / + // rm the first / for(i in list){ - list[i] = list[i].substring(req.query.path.length + 1) - let decomp = list[i].split('\\') - let np = '' - for(l in decomp){ - np += `/${decomp[l]}` + if(list[i].charAt(0) == '/'){ + list[i] = list[i].substring(1, list[i].indexOf('.')) + } + // a final sweep, for double / + if(list[i].charAt(0) == '/'){ + list[i] = list[i].substring(1) } - // wash of first / items and of file extension, - list[i] = np.substring(2, np.indexOf('.')) } + // console.log('sends', list) res.send(list) // ship up north, }).catch((err) => { diff --git a/filesys.js b/filesys.js index de35f79911422466a59639191543604628c0fd6b..d536c0ce7d8d72bee3a445aaaff429dd8c7b7593 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) => { + let tld = dir return new Promise((resolve, reject) => { // items and count, let list = [] @@ -23,7 +24,7 @@ module.exports = { for (file of files) { if (file.includes('.')) { if(debug) console.log('GDT pushing', `${dir}${file}`) - list.push(`${dir.substring(__dirname.length)}${file}`) + list.push(`${dir.substring(__dirname.length + tld.length)}/${file}`) } else { launch(`${dir}${file}`) } @@ -32,6 +33,7 @@ module.exports = { if(!count){ // we sort, list.sort() + console.log('list at fin getDirTree', list) resolve(list) } }) // end fs.readdir diff --git a/gogetter.js b/gogetter.js index 2be6b76bb9fc3d69d8a0537659333b221e823500..ed9427b86cb1b390b753a856647c86c49bd0892e 100644 --- a/gogetter.js +++ b/gogetter.js @@ -68,6 +68,7 @@ function GoGetter() { this.getJson = (path) => { return new Promise((resolve, reject) => { + console.log('to get', path) $.ajax({ url: path, type: 'GET', diff --git a/view/vcontextmenu.js b/view/vcontextmenu.js index 79637cc5ccd6dac0dc5877daea8e5fac1faf02b5..626583468db872700d094558c11c01e716e25e98 100644 --- a/view/vcontextmenu.js +++ b/view/vcontextmenu.js @@ -181,6 +181,7 @@ function cfContextMenu(evt, view, dt) { addContextOption('<i class="em em-construction_worker"></i> add a hunk', (ce) => { $(ce.target).closest('li').text('requesting a list of hunks...') scope.requestListAvail().then((stringlist) => { + //console.log('list', stringlist) changeContextTitle('load:') // sort the list... let treelike = [{