提交 4d6291cd 编写于 作者: B Benjamin Pasero

better fix for #44543

上级 1a8ff9ed
......@@ -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);
......
......@@ -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) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册