Handle references to nested paths that are not defined

This commit is contained in:
Nathan Shively-Sanders
2019-11-26 15:11:05 -08:00
committed by Andrew Branch
parent 0321ecd88e
commit 0de94cfe7d

View File

@@ -150,6 +150,9 @@ export class InMemoryDT implements FS {
let dir = this.curDir;
for (const component of components) {
const entry = component === ".." ? dir.parent : dir.get(component);
if (entry === undefined) {
return undefined;
}
if (!(entry instanceof Dir)) {
throw new Error(`No file system entry at ${this.pathToRoot}/${path}. Siblings are: ${Array.from(dir.keys())}`);
}