robusify VFS mem file handling

This commit is contained in:
Dany LE 2022-07-02 16:28:21 +02:00
parent 5734ce8ca9
commit 81d78aa8e5
3 changed files with 6492 additions and 6469 deletions

12941
d.ts/antos.d.ts vendored

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1437,7 +1437,8 @@ namespace OS {
type: "file",
};
}
/**
* Read the file meta-data
*
@ -1452,6 +1453,16 @@ namespace OS {
})
);
}
/**
* Get the parent file handle of the current file
*
*/
parent(): BaseFileHandle {
const handle = super.parent();
handle.info.type = "dir";
return handle;
}
/**
* Read file content stored in the file cached
@ -1463,6 +1474,13 @@ namespace OS {
*/
protected _rd(t: string): Promise<any> {
return new Promise((resolve, reject) => {
// read dir
if (this.info.type === "dir") {
return resolve({
result: [],
error: false,
});
}
return resolve(this.cache);
});
}