Skip to content

Commit e7e9de5

Browse files
author
Eric Snow
authored
Use the VS Code FS API in RawFileSystem. (microsoft#9846)
(for microsoft#8995) This is the last part of un-reverting the FS changes.
1 parent 0c2e52a commit e7e9de5

11 files changed

Lines changed: 1471 additions & 1227 deletions

File tree

news/3 Code Health/6911.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use the new VS Code filesystem API as much as possible.

src/client/common/platform/errors.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ interface ISystemError extends INodeJSError {
7878
port?: string;
7979
}
8080

81+
// Return a new error for errno ENOTEMPTY.
82+
export function createDirNotEmptyError(dirname: string): ISystemError {
83+
const err = new Error(`directory "${dirname}" not empty`) as ISystemError;
84+
err.name = 'SystemError';
85+
err.code = 'ENOTEMPTY';
86+
err.path = dirname;
87+
err.syscall = 'rmdir';
88+
return err;
89+
}
90+
8191
function isSystemError(err: Error, expectedCode: string): boolean | undefined {
8292
const code = (err as ISystemError).code;
8393
if (!code) {
@@ -130,3 +140,8 @@ export function isNoPermissionsError(err: Error): boolean | undefined {
130140
}
131141
return isSystemError(err, 'EACCES');
132142
}
143+
144+
// Return true if the given error is ENOTEMPTY.
145+
export function isDirNotEmptyError(err: Error): boolean | undefined {
146+
return isSystemError(err, 'ENOTEMPTY');
147+
}

0 commit comments

Comments
 (0)