168
throw createFileSystemProviderError(`File is not a directory`, FileSystemProviderErrorCode.FileNotADirectory);
169
}
171
>
172
>
const output = new Map<string, FileType>();
173
>
for (const content of contents) {
174
>
const contentURI = URI.parse(content.uri);
175
>
const contentPathParts = contentURI.path.split('/');
176
>
177
>
// Skip contents that are not in the same directory
178
>
if (contentPathParts.length <= resourcePathParts.length || !resourcePathParts.every((part, index) => equalsIgnoreCase(part, contentPathParts[index]))) {
179
continue;
180
}
182
>
// nested resource in a directory, just emit a directory to output
183
>
else if (contentPathParts.length > resourcePathParts.length + 1) {
184
>
output.set(contentPathParts[resourcePathParts.length], FileType.Directory);
185
>
}
186
>
187
>
else {
188
>
// resource in the same directory, emit the file
189
>
const name = contentPathParts[contentPathParts.length - 1];
190
>
output.set(name, contentToBuffer(content).byteLength > 0 ? FileType.File : FileType.Directory);
191
>
}
192
>
}
193
>
194
>
return [...output];
195
}
196