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:
@@ -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;
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user