diff --git a/app/resources/libs/Icestudio/Fuse/IceHD.js b/app/resources/libs/Icestudio/Fuse/IceHD.js index 1e0d169f1..261567e69 100644 --- a/app/resources/libs/Icestudio/Fuse/IceHD.js +++ b/app/resources/libs/Icestudio/Fuse/IceHD.js @@ -45,7 +45,14 @@ class IceHD { basename(filepath) { let b = this.path.basename(filepath); - return (b.indexOf('.') < 0) ? b : b.substr(0, b.lastIndexOf('.')); + let basen = b; + if (this.isFile(filepath)) { + + // Is file + basen = (b.indexOf('.') < 0) ? b : b.substr(0, b.lastIndexOf('.')); + } + console.log(basen); + return basen; } readDir(folder) { @@ -82,11 +89,13 @@ class IceHD { fileTree.push({ name: name, path: path, + isDir: true, children: (level >= 0) ? _this.getFilesRecursive(path, level) : [] }); } else if (validator.test(name)) { fileTree.push({ name: _this.basename(name), + isDir: false, path: path }); } diff --git a/app/resources/plugins/collectionService/js/CollectionService.js b/app/resources/plugins/collectionService/js/CollectionService.js index e8c8b3db4..efb457e81 100644 --- a/app/resources/plugins/collectionService/js/CollectionService.js +++ b/app/resources/plugins/collectionService/js/CollectionService.js @@ -185,11 +185,12 @@ class CollectionService { let posExtension = false; for (let i = 0; i < child.children.length; i++) { - posExtension = child.children[i].path.indexOf('.'); + posExtension = child.children[i].path.lastIndexOf('.'); + ext = child.children[i].path.substring(posExtension); // Only read .ice files and folders - if (ext == '.ice' || posExtension == -1) { + if (ext == '.ice' || child.children[i].isDir) { node.items.push(this.buildTreeBlocks(child.children[i], rootPath)); if (node.items[node.items.length - 1].isFolder === false) {