Skip to content

Commit

Permalink
Fix problems in collections dir indexing with dots in the path
Browse files Browse the repository at this point in the history
  • Loading branch information
cavearr committed Jun 29, 2023
1 parent c1387ab commit 39121d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion app/resources/libs/Icestudio/Fuse/IceHD.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 39121d1

Please sign in to comment.