提交 22170c2b 编写于 作者: J Johannes Rieken

remote - less readdir calls

上级 5b833336
......@@ -39,27 +39,27 @@ function toIFileStat(provider: IFileSystemProvider, tuple: [URI, IStat], recurse
etag: stat.mtime.toString(29) + stat.size.toString(31),
};
if (stat.type === FileType.File) {
// done
return TPromise.as(fileStat);
if (stat.type === FileType.Dir) {
fileStat.isDirectory = true;
fileStat.hasChildren = true;
} else {
if (recurse && recurse([resource, stat])) {
// dir -> resolve
return provider.readdir(resource).then(entries => {
fileStat.isDirectory = true;
fileStat.hasChildren = entries.length > 0;
if (recurse && recurse([resource, stat])) {
// resolve children if requested
return TPromise.join(entries.map(stat => toIFileStat(provider, stat, recurse))).then(children => {
fileStat.children = children;
return fileStat;
});
} else {
return fileStat;
}
});
}
}
// file or (un-resolved) dir
return TPromise.as(fileStat);
}
export function toDeepIFileStat(provider: IFileSystemProvider, tuple: [URI, IStat], to: URI[]): TPromise<IFileStat> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册