From 2ccf2b9b20fe612a085c91c3773ed8997c0500b2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 8 Jun 2021 22:07:29 +0200 Subject: [PATCH] BUG FIX Icons not loading fordawrd turned into backlash at icon paths. --- Client/httpInterface.js | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 234a60000..93418c86a 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -1085,31 +1085,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE case 'DirContent': { - let projects = getDirectories(global.env.PATH_TO_PROJECTS) - const fs = require('fs') + const folderPath = unescape(requestParameters[2]) + const folder = global.env.PATH_TO_PROJECTS + '/' + folderPath - let icons = [] - let totalProjects = projects.length - let projectCounter = 0 + getAllFilesInDirectoryAndSubdirectories(folder, onFilesReady) - for (let i = 0; i < projects.length; i++) { - let project = projects[i] - - const folder = global.env.PATH_TO_PROJECTS + '/' + project + '/Icons/' - - getAllFilesInDirectoryAndSubdirectories(folder, onFilesReady) - - function onFilesReady(files) { - for (let j = 0; j < files.length; j++) { - let file = files[j] - icons.push([project, file]) - } - - projectCounter++ - if (projectCounter === totalProjects) { - respondWithContent(JSON.stringify(icons), httpResponse) - } - } + function onFilesReady(files) { + respondWithContent(JSON.stringify(files), httpResponse) } } break @@ -1117,8 +1099,6 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE case 'IconNames': { let projects = getDirectories(global.env.PATH_TO_PROJECTS) - const fs = require('fs') - let icons = [] let totalProjects = projects.length let projectCounter = 0 @@ -1133,6 +1113,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE function onFilesReady(files) { for (let j = 0; j < files.length; j++) { let file = files[j] + for (let i = 0; i < 10; i++) { + file = file.replace('/', '\\') + } icons.push([project, file]) }