refactor(compiler-cli): add removeDir()
to FileSystem
(#35079)
PR Close #35079
This commit is contained in:

committed by
Misko Hevery

parent
16e15f50d2
commit
2e52fcf1eb
@ -131,6 +131,17 @@ export abstract class MockFileSystem implements FileSystem {
|
||||
}
|
||||
}
|
||||
|
||||
removeDeep(path: AbsoluteFsPath): void {
|
||||
const [folderPath, basename] = this.splitIntoFolderAndFile(path);
|
||||
const {entity} = this.findFromPath(folderPath);
|
||||
if (entity === null || !isFolder(entity)) {
|
||||
throw new MockFileSystemError(
|
||||
'ENOENT', path,
|
||||
`Unable to remove folder "${path}". The containing folder does not exist.`);
|
||||
}
|
||||
delete entity[basename];
|
||||
}
|
||||
|
||||
isRoot(path: AbsoluteFsPath): boolean { return this.dirname(path) === path; }
|
||||
|
||||
extname(path: AbsoluteFsPath|PathSegment): string {
|
||||
|
Reference in New Issue
Block a user