Skip to content

Commit 1dd4d09

Browse files
Drop pathExistsSync().
1 parent 7bbd06a commit 1dd4d09

File tree

4 files changed

+9
-54
lines changed

4 files changed

+9
-54
lines changed

src/client/common/platform/fileSystem.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,6 @@ export class FileSystemUtils implements IFileSystemUtils {
327327
public async directoryExists(dirname: string): Promise<boolean> {
328328
return this.pathExists(dirname, FileType.Directory);
329329
}
330-
public pathExistsSync(filename: string): boolean {
331-
try {
332-
this.raw.statSync(filename);
333-
} catch {
334-
return false;
335-
}
336-
return true;
337-
}
338330

339331
public async listdir(dirname: string): Promise<[string, FileType][]> {
340332
try {
@@ -436,6 +428,15 @@ export class FileSystem implements IFileSystem {
436428
return this.utils.search(globPattern);
437429
}
438430

431+
public fileExistsSync(filename: string): boolean {
432+
try {
433+
this.utils.raw.statSync(filename);
434+
} catch {
435+
return false;
436+
}
437+
return true;
438+
}
439+
439440
//****************************
440441
// aliases
441442

@@ -463,10 +464,6 @@ export class FileSystem implements IFileSystem {
463464
return this.utils.raw.copyFile(src, dest);
464465
}
465466

466-
public fileExistsSync(filename: string): boolean {
467-
return this.utils.pathExistsSync(filename);
468-
}
469-
470467
public readFileSync(filename: string): string {
471468
return this.utils.raw.readTextSync(filename);
472469
}

src/client/common/platform/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ export interface IFileSystemUtils {
139139

140140
// Decide if the two filenames are equivalent.
141141
arePathsSame(path1: string, path2: string): boolean; // Move to IPathUtils.
142-
// Determine if the file or directory exists.
143-
pathExistsSync(filename: string): boolean;
144142
}
145143

146144
// more aliases (to cause less churn)

src/test/common/platform/filesystem.functional.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -816,22 +816,6 @@ suite('FileSystem Utils', () => {
816816
});
817817
});
818818

819-
suite('pathExistsSync', () => {
820-
test('exists', async () => {
821-
const filename = await fix.createFile('x/y/z/spam.py');
822-
823-
const exists = utils.pathExistsSync(filename);
824-
825-
expect(exists).to.equal(true);
826-
});
827-
828-
test('not found', async () => {
829-
const exists = utils.pathExistsSync(DOES_NOT_EXIST);
830-
831-
expect(exists).to.equal(false);
832-
});
833-
});
834-
835819
suite('getSubDirectories', () => {
836820
test('mixed types', async () => {
837821
const symlinkSource = await fix.createFile('x/info.py');

src/test/common/platform/filesystem.unit.test.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -815,30 +815,6 @@ suite('FileSystem Utils', () => {
815815
});
816816
});
817817

818-
suite('pathExistsSync', () => {
819-
test('exists', async () => {
820-
const filename = 'x/y/z/spam.py';
821-
filesystem.setup(f => f.statSync(filename))
822-
.returns(() => stat.object);
823-
824-
const exists = utils.pathExistsSync(filename);
825-
826-
expect(exists).to.equal(true);
827-
verifyAll();
828-
});
829-
830-
test('not found', async () => {
831-
const filename = 'x/y/z/spam.py';
832-
filesystem.setup(f => f.statSync(filename))
833-
.throws(new Error('file not found'));
834-
835-
const exists = utils.pathExistsSync(filename);
836-
837-
expect(exists).to.equal(false);
838-
verifyAll();
839-
});
840-
});
841-
842818
suite('getSubDirectories', () => {
843819
test('mixed types', async () => {
844820
const dirname = 'x/y/z/spam';

0 commit comments

Comments
 (0)