- moved index code to dev.ts
- some work i dont know about or dont remember ¯\_(ツ)_/¯
This commit is contained in:
@@ -9,7 +9,7 @@ import { TreeNodeType, type DirectoryNode, type TreeNode } from "../filesystem/t
|
||||
""
|
||||
*/
|
||||
|
||||
export function resolvePath(state: ShellState, path: string): number {
|
||||
export function resolvePath(state: ShellState, path: string): string {
|
||||
const session = getCurrentSession(state);
|
||||
const isAbsolute = path.startsWith("/"); // true
|
||||
|
||||
@@ -40,7 +40,7 @@ export function resolvePath(state: ShellState, path: string): number {
|
||||
continue;
|
||||
}
|
||||
|
||||
const inode = currentNode.children[name];
|
||||
const inode = currentNode.content.get(name);
|
||||
|
||||
if (!inode)
|
||||
throw {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { IDataStore, NodeHash, ShadowHash, VDisk } from "@core/filesystem/vdisk";
|
||||
|
||||
export class VDiskManager {
|
||||
private _VDiskHash: Map<number, VDisk> = new Map();
|
||||
|
||||
public getVDisk(id: number): VDisk | undefined {
|
||||
const result = this._VDiskHash.get(id);
|
||||
if (result) return result;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public registerVDisk(
|
||||
store: IDataStore,
|
||||
base: NodeHash = new Map(),
|
||||
overlay: ShadowHash = new Map(),
|
||||
id: number = 0,
|
||||
): number {
|
||||
const vdisk: VDisk = {
|
||||
id,
|
||||
store,
|
||||
base,
|
||||
overlay,
|
||||
};
|
||||
|
||||
this._VDiskHash.set(id, vdisk);
|
||||
return id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user