Fixed FS class logic, with full support for table fs structure. Terminal sucressfully initializes (havent checked the commands) ls broken.

This commit is contained in:
2026-02-08 10:42:58 +01:00
parent 8e0ae3dd83
commit d404f5daab
8 changed files with 130 additions and 75 deletions
+7 -2
View File
@@ -98,6 +98,7 @@ export class VirtualFS {
}
private _findChildNodeByName(node: TreeNode, name: string): number {
console.log(name, node);
for(const childINode of node.children) {
const child = this.FsTable.get(childINode);
if(child && child.name === name) {
@@ -111,6 +112,10 @@ export class VirtualFS {
return typeof path === 'string' && path.startsWith('/');
};
getPathByInode(inode: number): string {
return this._iNodeToPathString(inode);
}
formatPath(path: string): string {
const prefix = this._iNodeToPathString(this.home);
if (path.startsWith(prefix)) {
@@ -146,7 +151,7 @@ export class VirtualFS {
return node;
}
private _getPathToNode(node: TreeNode): string[] {
/* private _getPathToNode(node: TreeNode): string[] {
const path: string[] = [];
let current = node;
path.push(node.name);
@@ -157,5 +162,5 @@ export class VirtualFS {
}
return path;
}
} */
}