diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts index d12eb3922a99a54f00810440b4ae25335701792c..18400de99eef446156e7d1a8be8dd37712401b7e 100644 --- a/src/vs/base/node/extfs.ts +++ b/src/vs/base/node/extfs.ts @@ -43,7 +43,12 @@ export function readdir(path: string, callback: (error: Error, files: string[]) return fs.readdir(path, callback); } -export function statLink(path: string, callback: (error: Error, statAndIsLink: { stat: fs.Stats, isSymbolicLink: boolean }) => void): void { +export interface IStatAndLink { + stat: fs.Stats; + isSymbolicLink: boolean; +} + +export function statLink(path: string, callback: (error: Error, statAndIsLink: IStatAndLink) => void): void { fs.lstat(path, (error, stat) => { if (error) { return callback(error, null); diff --git a/src/vs/workbench/services/files/node/fileService.ts b/src/vs/workbench/services/files/node/fileService.ts index 42bcf6f30de98ef58177670762e1ae71fcb3f66d..cf5433fee8231fec117bb33f5a7e130eaa108bda 100644 --- a/src/vs/workbench/services/files/node/fileService.ts +++ b/src/vs/workbench/services/files/node/fileService.ts @@ -42,7 +42,7 @@ import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/ import { getBaseLabel } from 'vs/base/common/labels'; import { assign } from 'vs/base/common/objects'; import { Readable } from 'stream'; -import { IWriteFileOptions } from 'vs/base/node/extfs'; +import { IWriteFileOptions, IStatAndLink } from 'vs/base/node/extfs'; import { Schemas } from 'vs/base/common/network'; export interface IEncodingOverride { @@ -1233,18 +1233,12 @@ export class StatResolver { }, function stat(this: any): void { - extfs.statLink(fileResource.fsPath, (error: Error, statAndIsLink) => { - if (error) { - return this(error, null); - } - - isSymbolicLink = statAndIsLink.isSymbolicLink; - this(null, statAndIsLink.stat); - }); + extfs.statLink(fileResource.fsPath, this); }, - function countChildren(this: any, fsstat: fs.Stats): void { - fileStat = fsstat; + function countChildren(this: any, statAndLink: IStatAndLink): void { + fileStat = statAndLink.stat; + isSymbolicLink = statAndLink.isSymbolicLink; if (fileStat.isDirectory()) { extfs.readdir(fileResource.fsPath, (error, result) => {