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

12807
d.ts/antos.d.ts vendored

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1438,6 +1438,7 @@ namespace OS {
}; };
} }
/** /**
* Read the file meta-data * Read the file meta-data
* *
@ -1453,6 +1454,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 * Read file content stored in the file cached
* *
@ -1463,6 +1474,13 @@ namespace OS {
*/ */
protected _rd(t: string): Promise<any> { protected _rd(t: string): Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// read dir
if (this.info.type === "dir") {
return resolve({
result: [],
error: false,
});
}
return resolve(this.cache); return resolve(this.cache);
}); });
} }